com.threerings.crowd.chat.client
Class ChatDirector.CommandHandler

java.lang.Object
  extended by com.threerings.crowd.chat.client.ChatDirector.CommandHandler
Direct Known Subclasses:
ChatDirector.BroadcastHandler, ChatDirector.ClearHandler, ChatDirector.EmoteHandler, ChatDirector.HelpHandler, ChatDirector.SpeakHandler, ChatDirector.TellHandler, ChatDirector.ThinkHandler
Enclosing class:
ChatDirector

public abstract static class ChatDirector.CommandHandler
extends Object

Used to implement a slash command (e.g. /who).


Field Summary
protected  String[] _aliases
          The command's translated aliases.
protected  String _usageKey
          The command's usage message translation key.
 
Constructor Summary
ChatDirector.CommandHandler()
           
 
Method Summary
 boolean checkAccess(BodyObject user)
          Returns true if this user should have access to this chat command.
 String getUsage(String command)
          Returns the translatable usage message for the specified command.
abstract  String handleCommand(SpeakService speakSvc, String command, String args, String[] history)
          Handles the specified chat command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_usageKey

protected String _usageKey
The command's usage message translation key.


_aliases

protected String[] _aliases
The command's translated aliases.

Constructor Detail

ChatDirector.CommandHandler

public ChatDirector.CommandHandler()
Method Detail

getUsage

public String getUsage(String command)
Returns the translatable usage message for the specified command.


handleCommand

public abstract String handleCommand(SpeakService speakSvc,
                                     String command,
                                     String args,
                                     String[] history)
Handles the specified chat command.

Parameters:
speakSvc - an optional SpeakService object representing the object to send the chat message on.
command - the slash command that was used to invoke this handler (e.g. /tell).
args - the arguments provided along with the command (e.g. Bob hello) or null if no arguments were supplied.
history - an in/out parameter that allows the command to modify the text that will be appended to the chat history. If this is set to null, nothing will be appended.
Returns:
an untranslated string that will be reported to the chat box to convey an error response to the user, or ChatCodes.SUCCESS.

checkAccess

public boolean checkAccess(BodyObject user)
Returns true if this user should have access to this chat command.