Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
MeCommand.java
1 package org.bukkit.command.defaults;
2 
3 import org.bukkit.Bukkit;
4 import org.bukkit.ChatColor;
6 
7 public class MeCommand extends VanillaCommand {
8  public MeCommand() {
9  super("me");
10  this.description = "Performs the specified action in chat";
11  this.usageMessage = "/me <action>";
12  this.setPermission("bukkit.command.me");
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  StringBuilder message = new StringBuilder();
24  message.append(sender.getName());
25 
26  for (String arg : args) {
27  message.append(" ");
28  message.append(arg);
29  }
30 
31  Bukkit.broadcastMessage("* " + message.toString());
32 
33  return true;
34  }
35 }
boolean testPermission(CommandSender target)
static int broadcastMessage(String message)
Definition: Bukkit.java:171
void sendMessage(String message)
void setPermission(String permission)