Merge pull request #305 from StrangeOne101/master

Fix Commands
This commit is contained in:
OmniCypher 2015-11-18 18:28:00 -08:00
commit 3a74a23d8b
6 changed files with 21 additions and 13 deletions

View file

@ -20,7 +20,7 @@ import java.util.List;
public class AddCommand extends PKCommand { public class AddCommand extends PKCommand {
public AddCommand() { public AddCommand() {
super("add", "/bending add <Player> [Element]", "This command will allow the user to add an element to the targeted <Player>, or themselves if the target is not specified. This command is typically reserved for server administrators.", new String[] { "add", "a" }); super("add", "/bending add <Element> [Player]", "This command will allow the user to add an element to the targeted <Player>, or themselves if the target is not specified. This command is typically reserved for server administrators.", new String[] { "add", "a" });
} }
public void execute(CommandSender sender, List<String> args) { public void execute(CommandSender sender, List<String> args) {
@ -35,12 +35,12 @@ public class AddCommand extends PKCommand {
if (!hasPermission(sender, "others")) { if (!hasPermission(sender, "others")) {
return; return;
} }
Player player = Bukkit.getPlayer(args.get(0)); Player player = Bukkit.getPlayer(args.get(1));
if (player == null) { if (player == null) {
sender.sendMessage(ChatColor.RED + "That player is not online."); sender.sendMessage(ChatColor.RED + "That player is not online.");
return; return;
} }
add(sender, player, args.get(1).toLowerCase()); add(sender, player, args.get(0).toLowerCase());
} }
} }

View file

@ -13,7 +13,6 @@ import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.SubElement;
import com.projectkorra.projectkorra.ability.AbilityModuleManager; import com.projectkorra.projectkorra.ability.AbilityModuleManager;
import com.projectkorra.projectkorra.ability.combo.ComboAbilityModule; import com.projectkorra.projectkorra.ability.combo.ComboAbilityModule;
import com.projectkorra.projectkorra.ability.combo.ComboModuleManager; import com.projectkorra.projectkorra.ability.combo.ComboModuleManager;
@ -85,11 +84,20 @@ public class BendingTabComplete implements TabCompleter
{ {
if (args.length > 3 || !sender.hasPermission("bending.command.add")) return new ArrayList<String>(); if (args.length > 3 || !sender.hasPermission("bending.command.add")) return new ArrayList<String>();
List<String> l = new ArrayList<String>(); List<String> l = new ArrayList<String>();
if (args.length == 2)
{
l.add("Air"); l.add("Air");
l.add("Earth"); l.add("Earth");
l.add("Fire"); l.add("Fire");
l.add("Water"); l.add("Water");
l.add("Chi"); l.add("Chi");
}
else
{
for (Player p : Bukkit.getOnlinePlayers()) {
l.add(p.getName());
}
}
return getPossibleCompletionsForGivenArgs(args, l); return getPossibleCompletionsForGivenArgs(args, l);
} }
else if (args[0].equalsIgnoreCase("clear") || args[0].equalsIgnoreCase("cl") || args[0].equalsIgnoreCase("c")) else if (args[0].equalsIgnoreCase("clear") || args[0].equalsIgnoreCase("cl") || args[0].equalsIgnoreCase("c"))

View file

@ -21,7 +21,7 @@ import java.util.List;
public class ChooseCommand extends PKCommand { public class ChooseCommand extends PKCommand {
public ChooseCommand() { public ChooseCommand() {
super("choose", "/bending choose [Element] <player>", "This command will allow the user to choose a player either for himself or <Player> if specified. This command can only be used once per player unless they have permission to rechoose their element.", new String[] { "choose", "ch" }); super("choose", "/bending choose <Element> [Player]", "This command will allow the user to choose a player either for himself or <Player> if specified. This command can only be used once per player unless they have permission to rechoose their element.", new String[] { "choose", "ch" });
} }
@Override @Override

View file

@ -16,7 +16,7 @@ import java.util.List;
public class ClearCommand extends PKCommand { public class ClearCommand extends PKCommand {
public ClearCommand() { public ClearCommand() {
super("clear", "/bending clear", "This command will clear the bound ability from the slot you specify (if you specify one). If you choose not to specify a slot, all of your abilities will be cleared.", new String[] { "clear", "cl", "c" }); super("clear", "/bending clear [Slot]", "This command will clear the bound ability from the slot you specify (if you specify one). If you choose not to specify a slot, all of your abilities will be cleared.", new String[] { "clear", "cl", "c" });
} }
@Override @Override

View file

@ -19,7 +19,7 @@ import java.util.List;
public class RemoveCommand extends PKCommand { public class RemoveCommand extends PKCommand {
public RemoveCommand() { public RemoveCommand() {
super("remove", "/bending remove [Player] <element>", "This command will remove the element of the targeted [Player]. The player will be able to re-pick their element after this command is run on them, assuming their Bending was not permaremoved.", new String[] { "remove", "rm" }); super("remove", "/bending remove <Player> [Element]", "This command will remove the element of the targeted [Player]. The player will be able to re-pick their element after this command is run on them, assuming their Bending was not permaremoved.", new String[] { "remove", "rm" });
} }
@Override @Override

View file

@ -34,7 +34,7 @@ public class WhoCommand extends PKCommand {
Map<String, String> staff = new HashMap<String, String>(); Map<String, String> staff = new HashMap<String, String>();
public WhoCommand() { public WhoCommand() {
super("who", "/bending who <Player>", "This command will tell you what element all players that are online are (If you don't specify a player) or give you information about the player that you specify.", new String[] { "who", "w" }); super("who", "/bending who [Player]", "This command will tell you what element all players that are online are (If you don't specify a player) or give you information about the player that you specify.", new String[] { "who", "w" });
staff.put("8621211e-283b-46f5-87bc-95a66d68880e", ChatColor.RED + "ProjectKorra Founder"); // MistPhizzle staff.put("8621211e-283b-46f5-87bc-95a66d68880e", ChatColor.RED + "ProjectKorra Founder"); // MistPhizzle