mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-02-27 01:31:21 +01:00
Add desti list
This commit is contained in:
parent
75d5fef5b0
commit
f5f7464c24
@ -163,21 +163,4 @@ public class Destination {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> destiList() {
|
|
||||||
|
|
||||||
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
|
||||||
|
|
||||||
LinkedList<String> destiList = new LinkedList<>();
|
|
||||||
|
|
||||||
Set<String> destiSet = config.getConfig().getKeys(false);
|
|
||||||
if (destiSet.size() > 0) {
|
|
||||||
for (Object desti : destiSet.toArray()) {
|
|
||||||
destiSet.add(desti.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Collections.sort(destiList);
|
|
||||||
return destiList;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -70,46 +70,9 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "list":
|
case "list":
|
||||||
List<String> destiList = Destination.destiList();
|
String message = PluginMessages.customPrefix + " \u00A77Destinations \u00A7c:\u00A7a";
|
||||||
if (destiList.size() >= 1) {
|
for (String desti : config.getConfig().getKeys(false)) message = message + " " + desti;
|
||||||
if (args.length > 1) {
|
sender.sendMessage(message);
|
||||||
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.");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user