From f5f7464c24f66b76b8f186369c24a8ec1c71cd6d Mon Sep 17 00:00:00 2001 From: Max Qian Date: Mon, 1 Aug 2016 22:28:12 -0700 Subject: [PATCH] Add desti list --- .../destinations/Destination.java | 17 -------- .../destinations/DestinationCommand.java | 43 ++----------------- 2 files changed, 3 insertions(+), 57 deletions(-) diff --git a/src/com/sekwah/advancedportals/destinations/Destination.java b/src/com/sekwah/advancedportals/destinations/Destination.java index 5c1f901..b559b58 100644 --- a/src/com/sekwah/advancedportals/destinations/Destination.java +++ b/src/com/sekwah/advancedportals/destinations/Destination.java @@ -163,21 +163,4 @@ public class Destination { } return false; } - - public static List destiList() { - - ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml"); - - LinkedList destiList = new LinkedList<>(); - - Set destiSet = config.getConfig().getKeys(false); - if (destiSet.size() > 0) { - for (Object desti : destiSet.toArray()) { - destiSet.add(desti.toString()); - } - } - - Collections.sort(destiList); - return destiList; - } } diff --git a/src/com/sekwah/advancedportals/destinations/DestinationCommand.java b/src/com/sekwah/advancedportals/destinations/DestinationCommand.java index b3e9af3..38f9943 100644 --- a/src/com/sekwah/advancedportals/destinations/DestinationCommand.java +++ b/src/com/sekwah/advancedportals/destinations/DestinationCommand.java @@ -70,46 +70,9 @@ public class DestinationCommand implements CommandExecutor, TabCompleter { } break; case "list": - List destiList = Destination.destiList(); - if (destiList.size() >= 1) { - if (args.length > 1) { - try { - int page = Integer.parseInt(args[1]); - if (page * 5 >= destiList.size() - 5) { // add this if statement so that the user cant select a list page higher than the max - if (destiList.size() / 5 == destiList.size()) { - - } - } - sender.sendMessage(PluginMessages.customPrefix + " Showing destinations page 1 of 1"); - for (int i = (page - 1) * 5; i < page * 5; i++) { - if (i > destiList.size()) { - break; - } - sender.sendMessage(" \u00A7e" + destiList.get(i)); - } - return true; - } catch (Exception e) { - } - } - - sender.sendMessage(PluginMessages.customPrefix + " Showing destinations page 1 of 1"); - for (int i = 0; i < 5; i++) { - if (i > destiList.size()) { - break; - } - sender.sendMessage(" \u00A7e" + destiList.get(i)); - } - - sender.sendMessage(PluginMessages.customPrefix + " Showing destinations page 1 of 1"); - for (int i = 0; i < 5; i++) { - if (i > destiList.size()) { - break; - } - sender.sendMessage(" \u00A7e" + destiList.get(i)); - } - } else { - sender.sendMessage(PluginMessages.customPrefixFail + " There are currently no defined destinations."); - } + String message = PluginMessages.customPrefix + " \u00A77Destinations \u00A7c:\u00A7a"; + for (String desti : config.getConfig().getKeys(false)) message = message + " " + desti; + sender.sendMessage(message); break; } } else {