Merge pull request #359 from jedk1/master

Various Fixes (Read desc)
This commit is contained in:
OmniCypher 2016-01-01 13:39:19 -08:00
commit a4275cfede
4 changed files with 26 additions and 7 deletions

View file

@ -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()) {
strings.add(command.getProperUse()); 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); sender.sendMessage(ChatColor.YELLOW + s);
} }
return; return;
@ -44,9 +51,15 @@ public class HelpCommand extends PKCommand {
if (isNumeric(arg)) { if (isNumeric(arg)) {
List<String> strings = new ArrayList<String>(); List<String> strings = new ArrayList<String>();
for (PKCommand command : instances.values()) { for (PKCommand command : instances.values()) {
strings.add(command.getProperUse()); 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); 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

View file

@ -186,9 +186,11 @@ public abstract class PKCommand implements SubCommand {
* @param page * @param page
* @return * @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>(); List<String> strings = new ArrayList<String>();
Collections.sort(entries); if (alphabetical) {
Collections.sort(entries);
}
if (page < 1) { if (page < 1) {
page = 1; page = 1;

View file

@ -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);
} }
} }

View file

@ -170,6 +170,10 @@ public class WaterArms {
remove(); remove();
return; return;
} }
if (!GeneralMethods.canBend(player.getName(), "WaterArms")) {
remove();
return;
}
if (!GeneralMethods.getBendingPlayer(player.getName()).isToggled()) { if (!GeneralMethods.getBendingPlayer(player.getName()).isToggled()) {
remove(); remove();
return; return;