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.
This commit is contained in:
parent
fcb5b20e27
commit
1819a9e00e
@ -55,6 +55,7 @@ public class SimpleCommandMap implements CommandMap {
|
|||||||
fallbackCommands.add(new ClearCommand());
|
fallbackCommands.add(new ClearCommand());
|
||||||
fallbackCommands.add(new GameRuleCommand());
|
fallbackCommands.add(new GameRuleCommand());
|
||||||
fallbackCommands.add(new EnchantCommand());
|
fallbackCommands.add(new EnchantCommand());
|
||||||
|
fallbackCommands.add(new TestForCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleCommandMap(final Server server) {
|
public SimpleCommandMap(final Server server) {
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user