All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class key.Command

java.lang.Object
   |
   +----key.Atom
           |
           +----key.Command

public abstract class Command
extends Atom
The base class for a command also includes some nice utility routines that command writers tend to need


Constructor Index

 o Command()

Method Index

 o getElementInside(InteractiveConnection, String, Container)
 o getElementInside(InteractiveConnection, String, Type, Container)
 o getOnlinePlayer(Player, InteractiveConnection, String)
The basic concept is this: The routine returns a player, or null.
 o getPlayer(InteractiveConnection, String)
This routine will return a Player or null.
 o getPlayerInside(Player, InteractiveConnection, String, Scape)
An atom is returned in case they are like 'player,player,player', so it will return a scape
 o getSymbol(InteractiveConnection, String)
A slightly higher level routine - will match the symbol and give error messages as appropriate.
 o getSymbol(InteractiveConnection, String, Type)
 o getSymbolInside(InteractiveConnection, String, Atom)
 o getSymbolInside(InteractiveConnection, String, Type, Atom)
 o getTagElementInside(InteractiveConnection, String, Container)
 o getTagSymbolInside(InteractiveConnection, String, Atom)
 o run(Player, StringTokenizer, String, ModalCommand, InteractiveConnection, Flags)
If this method is not overridden, it calls the others.
 o setOrDefault(DataProperty, DataProperty)
Returns self if its non-null, else main (string properties only)
 o usage(InteractiveConnection)

Constructors

 o Command
 public Command()

Methods

 o usage
 public void usage(InteractiveConnection ic)
 o run
 public abstract void run(Player p,
                          StringTokenizer args,
                          String fullLine,
                          ModalCommand caller,
                          InteractiveConnection ic,
                          Flags flags) throws IOException
If this method is not overridden, it calls the others. Only override *one*, depending on what arguments you want to recieve

Presumably you'll want to do one or the other, overload the method you'd prefer

Parameters:
p - the player who is executing the command
args - a tokenizer (whitespace) for the command arguments
fullLine - the complete line that was typed
caller - the parent ModalCommand that contains this command
ic - the interactiveConnection to send the results to
 o getPlayerInside
 public final Atom getPlayerInside(Player p,
                                   InteractiveConnection ic,
                                   String name,
                                   Scape inside)
An atom is returned in case they are like 'player,player,player', so it will return a scape

 o getOnlinePlayer
 public final Atom getOnlinePlayer(Player p,
                                   InteractiveConnection ic,
                                   String name)
The basic concept is this: The routine returns a player, or null. If it returns null, it has already output an error message to the player involved, so you don't have to. (just return) An atom is returned in case they are like 'player,player,player', so it will return a scape

 o getTagSymbolInside
 public final Symbol getTagSymbolInside(InteractiveConnection ic,
                                        String s,
                                        Atom inside)
 o getSymbolInside
 public final Atom getSymbolInside(InteractiveConnection ic,
                                   String s,
                                   Atom inside)
 o getSymbol
 public final Atom getSymbol(InteractiveConnection ic,
                             String s)
A slightly higher level routine - will match the symbol and give error messages as appropriate. It is not necessary to check for anything other than the return being null, in which case an error has already been sent to the provided connection.

 o getTagElementInside
 public final Tag getTagElementInside(InteractiveConnection ic,
                                      String s,
                                      Container inside)
 o getElementInside
 public final Atom getElementInside(InteractiveConnection ic,
                                    String s,
                                    Type type,
                                    Container inside)
 o getElementInside
 public final Atom getElementInside(InteractiveConnection ic,
                                    String s,
                                    Container inside)
 o getSymbolInside
 public final Atom getSymbolInside(InteractiveConnection ic,
                                   String s,
                                   Type type,
                                   Atom i)
 o getSymbol
 public final Atom getSymbol(InteractiveConnection ic,
                             String s,
                             Type type)
 o getPlayer
 public final Player getPlayer(InteractiveConnection ic,
                               String name)
This routine will return a Player or null.

 o setOrDefault
 protected final String setOrDefault(DataProperty self,
                                     DataProperty main)
Returns self if its non-null, else main (string properties only)


All Packages  Class Hierarchy  This Package  Previous  Next  Index