diff --git a/src/main/java/tech/sbdevelopment/v10lift/commands/V10LiftCommand.java b/src/main/java/tech/sbdevelopment/v10lift/commands/V10LiftCommand.java index bf449b2..feac92f 100644 --- a/src/main/java/tech/sbdevelopment/v10lift/commands/V10LiftCommand.java +++ b/src/main/java/tech/sbdevelopment/v10lift/commands/V10LiftCommand.java @@ -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 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 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)) { diff --git a/src/main/resources/messages.yml b/src/main/resources/messages.yml index a8ece23..26ebaf1 100644 --- a/src/main/resources/messages.yml +++ b/src/main/resources/messages.yml @@ -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%' \ No newline at end of file