Implemented /v10lift list, closes #58

This commit is contained in:
Stijn Bannink 2023-08-13 18:22:54 +02:00
parent d6ca0d4bec
commit a1b1deaafe
2 changed files with 22 additions and 0 deletions

View file

@ -35,6 +35,9 @@ public class V10LiftCommand implements CommandExecutor {
} else if (args[0].equalsIgnoreCase("info") && args.length == 1) { } else if (args[0].equalsIgnoreCase("info") && args.length == 1) {
//v10lift info //v10lift info
return infoCommand(sender); 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)) { } else if (args[0].equalsIgnoreCase("create") && (args.length == 1 || args.length == 2)) {
//v10lift create || v10lift create <Name> //v10lift create || v10lift create <Name>
if (!(sender instanceof Player)) { if (!(sender instanceof Player)) {
@ -248,6 +251,20 @@ public class V10LiftCommand implements CommandExecutor {
return true; 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) { private boolean disableCommand(CommandSender sender, @Nonnull String[] args) {
String liftName = args[1]; String liftName = args[1];
if (!DataManager.containsLift(liftName)) { if (!DataManager.containsLift(liftName)) {

View file

@ -159,3 +159,8 @@ LiftSign:
NoName: '&cNo lift name given!' NoName: '&cNo lift name given!'
Created: '&aLift sign created!' Created: '&aLift sign created!'
Removed: '&6Lift sign removed!' Removed: '&6Lift sign removed!'
List:
NoLifts: '&cThere are no lifts!'
Header: '&6Lifts:'
Lift: '&6- %Name%'