Add dummy /testfor command in Bukkit. Addresses BUKKIT-3813

This command only functions in command blocks so the bukkit command for it
simply spits out an error message.

By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
Bukkit/Spigot 2013-03-18 17:10:52 -05:00
parent cc30a80aa3
commit 2c2f644ccd
2 changed files with 27 additions and 0 deletions

View file

@ -55,6 +55,7 @@ public class SimpleCommandMap implements CommandMap {
fallbackCommands.add(new ClearCommand());
fallbackCommands.add(new GameRuleCommand());
fallbackCommands.add(new EnchantCommand());
fallbackCommands.add(new TestForCommand());
}
public SimpleCommandMap(final Server server) {

View file

@ -0,0 +1,26 @@
package org.bukkit.command.defaults;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class TestForCommand extends VanillaCommand {
public TestForCommand() {
super("testfor");
this.description = "Tests whether a specifed player is online";
this.usageMessage = "/testfor <player>";
this.setPermission("bukkit.command.testfor");
}
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!testPermission(sender)) return true;
if (args.length < 1) {
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
return false;
}
sender.sendMessage(ChatColor.RED + "/testfor is only usable by commandblocks with analog output.");
return true;
}
}