mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-12 03:59:06 +00:00
Update to use alphabetical sorting
This commit is contained in:
parent
77bd84f35d
commit
e1f986ae53
2 changed files with 11 additions and 4 deletions
|
@ -14,6 +14,7 @@ import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,9 +32,15 @@ public class HelpCommand extends PKCommand {
|
||||||
else if (args.size() == 0) {
|
else if (args.size() == 0) {
|
||||||
List<String> strings = new ArrayList<String>();
|
List<String> strings = new ArrayList<String>();
|
||||||
for (PKCommand command : instances.values()) {
|
for (PKCommand command : instances.values()) {
|
||||||
|
if (!command.getName().equalsIgnoreCase("help")) {
|
||||||
strings.add(command.getProperUse());
|
strings.add(command.getProperUse());
|
||||||
}
|
}
|
||||||
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", 1)) {
|
}
|
||||||
|
Collections.sort(strings);
|
||||||
|
Collections.reverse(strings);
|
||||||
|
strings.add(instances.get("help").getProperUse());
|
||||||
|
Collections.reverse(strings);
|
||||||
|
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", 1, false)) {
|
||||||
sender.sendMessage(ChatColor.YELLOW + s);
|
sender.sendMessage(ChatColor.YELLOW + s);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -46,7 +53,7 @@ public class HelpCommand extends PKCommand {
|
||||||
for (PKCommand command : instances.values()) {
|
for (PKCommand command : instances.values()) {
|
||||||
strings.add(command.getProperUse());
|
strings.add(command.getProperUse());
|
||||||
}
|
}
|
||||||
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", Integer.valueOf(arg))) {
|
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", Integer.valueOf(arg), true)) {
|
||||||
sender.sendMessage(ChatColor.YELLOW + s);
|
sender.sendMessage(ChatColor.YELLOW + s);
|
||||||
}
|
}
|
||||||
} else if (instances.keySet().contains(arg.toLowerCase())) {//bending help command
|
} else if (instances.keySet().contains(arg.toLowerCase())) {//bending help command
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class WhoCommand extends PKCommand {
|
||||||
//for (String st : players) {
|
//for (String st : players) {
|
||||||
// sender.sendMessage(st);
|
// sender.sendMessage(st);
|
||||||
//}
|
//}
|
||||||
for (String s : getPage(players, ChatColor.GOLD + "Players:", page)) {
|
for (String s : getPage(players, ChatColor.GOLD + "Players:", page, true)) {
|
||||||
sender.sendMessage(s);
|
sender.sendMessage(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue