Implemented /v10lift list, closes #58
This commit is contained in:
parent
d6ca0d4bec
commit
a1b1deaafe
2 changed files with 22 additions and 0 deletions
|
@ -35,6 +35,9 @@ public class V10LiftCommand implements CommandExecutor {
|
|||
} else if (args[0].equalsIgnoreCase("info") && args.length == 1) {
|
||||
//v10lift info
|
||||
return infoCommand(sender);
|
||||
} else if (args[0].equalsIgnoreCase("list") && args.length == 1) {
|
||||
//v10lift list
|
||||
return listCommand(sender);
|
||||
} else if (args[0].equalsIgnoreCase("create") && (args.length == 1 || args.length == 2)) {
|
||||
//v10lift create || v10lift create <Name>
|
||||
if (!(sender instanceof Player)) {
|
||||
|
@ -248,6 +251,20 @@ public class V10LiftCommand implements CommandExecutor {
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean listCommand(CommandSender sender) {
|
||||
//Send list of all lifts
|
||||
Map<String, Lift> lifts = DataManager.getLifts();
|
||||
if (lifts.isEmpty()) {
|
||||
ConfigUtil.sendMessage(sender, "List.NoLifts");
|
||||
return true;
|
||||
}
|
||||
ConfigUtil.sendMessage(sender, "List.Header");
|
||||
for (String liftName : lifts.keySet()) {
|
||||
ConfigUtil.sendMessage(sender, "List.Lift", Map.of("%Name%", liftName));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean disableCommand(CommandSender sender, @Nonnull String[] args) {
|
||||
String liftName = args[1];
|
||||
if (!DataManager.containsLift(liftName)) {
|
||||
|
|
|
@ -159,3 +159,8 @@ LiftSign:
|
|||
NoName: '&cNo lift name given!'
|
||||
Created: '&aLift sign created!'
|
||||
Removed: '&6Lift sign removed!'
|
||||
|
||||
List:
|
||||
NoLifts: '&cThere are no lifts!'
|
||||
Header: '&6Lifts:'
|
||||
Lift: '&6- %Name%'
|
Loading…
Reference in a new issue