mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-31 22:22:49 +00:00
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
2 changed files with 27 additions and 0 deletions
|
@ -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) {
|
||||
|
|
|
@ -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…
Add table
Reference in a new issue