mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-12 03:59:06 +00:00
commit
a4275cfede
4 changed files with 26 additions and 7 deletions
|
@ -14,6 +14,7 @@ import org.bukkit.command.CommandSender;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -31,9 +32,15 @@ public class HelpCommand extends PKCommand {
|
|||
else if (args.size() == 0) {
|
||||
List<String> strings = new ArrayList<String>();
|
||||
for (PKCommand command : instances.values()) {
|
||||
if (!command.getName().equalsIgnoreCase("help")) {
|
||||
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);
|
||||
}
|
||||
return;
|
||||
|
@ -44,9 +51,15 @@ public class HelpCommand extends PKCommand {
|
|||
if (isNumeric(arg)) {
|
||||
List<String> strings = new ArrayList<String>();
|
||||
for (PKCommand command : instances.values()) {
|
||||
if (!command.getName().equalsIgnoreCase("help")) {
|
||||
strings.add(command.getProperUse());
|
||||
}
|
||||
for (String s : getPage(strings, ChatColor.GOLD + "Commands: <required> [optional]", Integer.valueOf(arg))) {
|
||||
}
|
||||
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]", Integer.valueOf(arg), false)) {
|
||||
sender.sendMessage(ChatColor.YELLOW + s);
|
||||
}
|
||||
} else if (instances.keySet().contains(arg.toLowerCase())) {//bending help command
|
||||
|
|
|
@ -186,9 +186,11 @@ public abstract class PKCommand implements SubCommand {
|
|||
* @param page
|
||||
* @return
|
||||
*/
|
||||
protected List<String> getPage(List<String> entries, String title, int page) {
|
||||
protected List<String> getPage(List<String> entries, String title, int page, boolean alphabetical) {
|
||||
List<String> strings = new ArrayList<String>();
|
||||
if (alphabetical) {
|
||||
Collections.sort(entries);
|
||||
}
|
||||
|
||||
if (page < 1) {
|
||||
page = 1;
|
||||
|
|
|
@ -135,7 +135,7 @@ public class WhoCommand extends PKCommand {
|
|||
//for (String st : players) {
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,6 +170,10 @@ public class WaterArms {
|
|||
remove();
|
||||
return;
|
||||
}
|
||||
if (!GeneralMethods.canBend(player.getName(), "WaterArms")) {
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
if (!GeneralMethods.getBendingPlayer(player.getName()).isToggled()) {
|
||||
remove();
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue