001 package org.bukkit.command.defaults; 002 003 import org.bukkit.Bukkit; 004 import org.bukkit.ChatColor; 005 import org.bukkit.command.CommandSender; 006 007 public class MeCommand extends VanillaCommand { 008 public MeCommand() { 009 super("me"); 010 this.description = "Performs the specified action in chat"; 011 this.usageMessage = "/me <action>"; 012 this.setPermission("bukkit.command.me"); 013 } 014 015 @Override 016 public boolean execute(CommandSender sender, String currentAlias, String[] args) { 017 if (!testPermission(sender)) return true; 018 if (args.length < 1) { 019 sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); 020 return false; 021 } 022 023 StringBuilder message = new StringBuilder(); 024 message.append(sender.getName()); 025 026 for (String arg : args) { 027 message.append(" "); 028 message.append(arg); 029 } 030 031 Bukkit.broadcastMessage("* " + message.toString()); 032 033 return true; 034 } 035 }