mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-21 15:54:45 +01: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. By: Travis Watkins <amaranth@ubuntu.com>
This commit is contained in:
parent
cc30a80aa3
commit
2c2f644ccd
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