diff options
Diffstat (limited to 'src/main/java/org/bukkit/command/defaults/OpCommand.java')
-rw-r--r-- | src/main/java/org/bukkit/command/defaults/OpCommand.java | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/main/java/org/bukkit/command/defaults/OpCommand.java b/src/main/java/org/bukkit/command/defaults/OpCommand.java deleted file mode 100644 index f5bb8b15..00000000 --- a/src/main/java/org/bukkit/command/defaults/OpCommand.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.bukkit.command.defaults; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; - -import com.google.common.collect.ImmutableList; - -@Deprecated -public class OpCommand extends VanillaCommand { - public OpCommand() { - super("op"); - this.description = "Gives the specified player operator status"; - this.usageMessage = "/op <player>"; - this.setPermission("bukkit.command.op.give"); - } - - @Override - public boolean execute(CommandSender sender, String currentAlias, String[] args) { - if (!testPermission(sender)) return true; - if (args.length != 1 || args[0].length() == 0) { - sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); - return false; - } - - OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]); - player.setOp(true); - - Command.broadcastCommandMessage(sender, "Opped " + args[0]); - return true; - } - - @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) { - if (!(sender instanceof Player)) { - return ImmutableList.of(); - } - - String lastWord = args[0]; - if (lastWord.length() == 0) { - return ImmutableList.of(); - } - - Player senderPlayer = (Player) sender; - - ArrayList<String> matchedPlayers = new ArrayList<String>(); - for (Player player : sender.getServer().getOnlinePlayers()) { - String name = player.getName(); - if (!senderPlayer.canSee(player) || player.isOp()) { - continue; - } - if (StringUtil.startsWithIgnoreCase(name, lastWord)) { - matchedPlayers.add(name); - } - } - - Collections.sort(matchedPlayers, String.CASE_INSENSITIVE_ORDER); - return matchedPlayers; - } - return ImmutableList.of(); - } -} |