diff options
author | EvilSeph <evilseph@gmail.com> | 2012-10-30 02:50:38 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-10-30 02:50:38 -0400 |
commit | 2d5ae73809c4322878534c6abb1b0b58061f0374 (patch) | |
tree | 4833fc6b504cce6e697294c3494e78f946c24277 /src/main | |
parent | 9907150d92934a98fdda78709b2dd9f2fafbb7b8 (diff) | |
download | bukkit-2d5ae73809c4322878534c6abb1b0b58061f0374.tar bukkit-2d5ae73809c4322878534c6abb1b0b58061f0374.tar.gz bukkit-2d5ae73809c4322878534c6abb1b0b58061f0374.tar.lz bukkit-2d5ae73809c4322878534c6abb1b0b58061f0374.tar.xz bukkit-2d5ae73809c4322878534c6abb1b0b58061f0374.zip |
Revert "Clear" commit, was not meant to be pushed.
This reverts commit bdf5d326f5910993c1f7e48b4409f7b0d53c1926.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/command/SimpleCommandMap.java | 1 | ||||
-rw-r--r-- | src/main/java/org/bukkit/command/defaults/ClearCommand.java | 109 |
2 files changed, 0 insertions, 110 deletions
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java index 7e007c57..292f7686 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -56,7 +56,6 @@ public class SimpleCommandMap implements CommandMap { fallbackCommands.add(new DifficultyCommand()); fallbackCommands.add(new WeatherCommand()); fallbackCommands.add(new SpawnpointCommand()); - fallbackCommands.add(new ClearCommand()); } public SimpleCommandMap(final Server server) { diff --git a/src/main/java/org/bukkit/command/defaults/ClearCommand.java b/src/main/java/org/bukkit/command/defaults/ClearCommand.java deleted file mode 100644 index c5fa41c1..00000000 --- a/src/main/java/org/bukkit/command/defaults/ClearCommand.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.bukkit.command.defaults; - -import com.google.common.collect.ImmutableList; -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.StringUtil; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public class ClearCommand extends VanillaCommand { - private static List<String> materials; - static { - ArrayList<String> materialList = new ArrayList<String>(); - for (Material material : Material.values()) { - materialList.add(material.name()); - } - Collections.sort(materialList); - materials = ImmutableList.copyOf(materialList); - } - - public ClearCommand() { - super("clear"); - this.description = "Clears the player's inventory. Can specify item and data filters too."; - this.usageMessage = "/clear <player> [item] [data]"; - this.setPermission("bukkit.command.clear"); - } - - @Override - public boolean execute(CommandSender sender, String currentAlias, String[] args) { - if (!testPermission(sender)) return true; - if ((args.length < 2)) { - sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); - return false; - } - - Player player = null; - if (args.length > 1) { - player = Bukkit.getPlayer(args[1]); - } else if (sender instanceof Player) { - player = (Player) sender; - } - - if (player != null) { - int id = args.length >= 2 ? getInteger(sender, args[1], 1) : -1; - int data = args.length >= 3 ? getInteger(sender, args[2], 0) : -1; - ItemStack matchItem = new ItemStack(); - player.getInventory().all(matchItem) - int count = player.getInventory().clear(id, data); - player.updateInventory(); - } else { - sender.sendMessage("Can't find user " + args[0]); - } - - return true; - } - - @Override - public boolean matches(String input) { - return input.equalsIgnoreCase("clear"); - } - - @Override - public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { - Validate.notNull(sender, "Sender cannot be null"); - Validate.notNull(args, "Arguments cannot be null"); - Validate.notNull(alias, "Alias cannot be null"); - - if (args.length == 1) { - return super.tabComplete(sender, alias, args); - } - if (args.length == 2) { - final String arg = args[1]; - final List<String> materials = ClearCommand.materials; - List<String> completion = null; - - final int size = materials.size(); - int i = Collections.binarySearch(materials, arg, String.CASE_INSENSITIVE_ORDER); - - if (i < 0) { - // Insertion (start) index - i = -1 - i; - } - - for ( ; i < size; i++) { - String material = materials.get(i); - if (StringUtil.startsWithIgnoreCase(material, arg)) { - if (completion == null) { - completion = new ArrayList<String>(); - } - completion.add(material); - } else { - break; - } - } - - if (completion != null) { - return completion; - } - } - return ImmutableList.of(); - } -} |