Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
TestForCommand.java
1 package org.bukkit.command.defaults;
2 
3 import org.bukkit.Bukkit;
4 import org.bukkit.ChatColor;
6 
7 public class TestForCommand extends VanillaCommand {
8  public TestForCommand() {
9  super("testfor");
10  this.description = "Tests whether a specifed player is online";
11  this.usageMessage = "/testfor <player>";
12  this.setPermission("bukkit.command.testfor");
13  }
14 
15  @Override
16  public boolean execute(CommandSender sender, String currentAlias, String[] args) {
17  if (!testPermission(sender)) return true;
18  if (args.length < 1) {
19  sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage);
20  return false;
21  }
22 
23  sender.sendMessage(ChatColor.RED + "/testfor is only usable by commandblocks with analog output.");
24  return true;
25  }
26 }
boolean testPermission(CommandSender target)
void sendMessage(String message)
void setPermission(String permission)