wyvern.lib.commands
Class WhoCommand

java.lang.Object
  extended bywyvern.kernel.properties.PList
      extended bywyvern.kernel.commands.SimpleHandler
          extended bywyvern.lib.commands.WhoCommand
All Implemented Interfaces:
BuiltInCommand, Command, PropertyList

public class WhoCommand
extends SimpleHandler

This class shows the player a list of players on the game.

Version:
1.0, Jan 23, 1998
Author:
Steve Yegge

Field Summary
 
Fields inherited from class wyvern.kernel.commands.SimpleHandler
delay_
 
Fields inherited from class wyvern.kernel.properties.PList
readOnly_
 
Fields inherited from interface wyvern.lib.PropertyList
PROPERTY_PACKAGE
 
Method Summary
 void addCommands(java.util.Map commands, CommandList list)
          Adds our commands.
static boolean canSee(Player playerA, Player playerB)
          Returns true if player A can see player B in the who list (who, mapwho, users, pdawho, etc.)
static WhoCommand getImpl()
           
 boolean handleEvent(CommandEvent event)
          Callback method for subclasses to handle their command.
static java.lang.String printPDAPlayerEntry(Player p)
          Prints a player entry to the string buffer.
 java.util.List printPDAWhoList(Player agent)
          Shows the who-list in narrow form.
static java.lang.String printPDAWizardEntry(Player p)
          Prints a wizard line in narrow form.
static java.lang.String printPlayerEntry(Player p)
          Prints a player entry to the string buffer.
static java.util.List printWhoList(Predicate filter)
          Prints list of everyone online who matches a certain filter.
static java.lang.String printWizardEntry(Player p)
          Prints a wizard line.
 
Methods inherited from class wyvern.kernel.commands.SimpleHandler
createEvent, execute, knowsCommand
 
Methods inherited from class wyvern.kernel.properties.PList
addProperty, addTransientProperty, adjustDoubleProperty, adjustIntProperty, adjustLongProperty, adjustTransientDoubleProperty, adjustTransientIntProperty, adjustTransientLongProperty, countLocalProperties, debugProperties, dismantlePropertyList, getDoubleProperty, getInheritedProperty, getInteger, getIntProperty, getLocalProperties, getLocalProperty, getLongProperty, getParent, getPersistentDoubleProperty, getPersistentIntProperty, getPersistentLocalProperties, getPersistentLongProperty, getPersistentProperty, getProfilingInfo, getProperties, getProperties, getPropertiesIncludingTransients, getPropertiesIncludingTransients, getProperty, getSerializableProperties, getSerializableProperty, getStringProperty, getTransientDoubleProperty, getTransientIntProperty, getTransientLongProperty, getTransientProperties, getTransientProperty, hasLocalProperty, hasPersistentProperty, hasProperty, hasTransientProperty, inheritProperty, isReadOnly, isRemoved, isTransientlyRemoved, printLocalProperties, printProperties, printProperties, printTransientProperties, removeProperty, removeTransientProperty, setDoubleProperty, setIntProperty, setLongProperty, setParent, setProperty, setReadOnly, setTransientDoubleProperty, setTransientIntProperty, setTransientLongProperty, setTransientProperty, toString, toString, transientlyRemoveProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getImpl

public static WhoCommand getImpl()

addCommands

public void addCommands(java.util.Map commands,
                        CommandList list)
Description copied from class: SimpleHandler
Adds our commands. Subclasses should override this and, for each command the subclass wants to implement, put it in the "commands" map.

Specified by:
addCommands in interface BuiltInCommand
Specified by:
addCommands in class SimpleHandler
Parameters:
commands - a Map whose keys are the command verbs, and whose values are references to the SimpleHandler instance that wants to handle the command.
list - the Player, Monster, Vehicle or other CommandList implementation for which addCommands() is being called.

handleEvent

public boolean handleEvent(CommandEvent event)
Description copied from class: SimpleHandler
Callback method for subclasses to handle their command.

Specified by:
handleEvent in class SimpleHandler
Parameters:
event - a CommandEvent with various fields filled in: the agent performing the command, the command verb and arguments, the delay for the command, and success/failure messages.
Returns:
true if the event was completed successfully; false if it couldn't be executed for some reason. It's important to return the right value, since the appropriate post-hook will be run depending on whether the command succeeded or failed.

printWhoList

public static java.util.List printWhoList(Predicate filter)
Prints list of everyone online who matches a certain filter.

Parameters:
filter - a filter that takes a Player and returns true if we want to include the player in the result list.
Returns:
a List of lines to print, one per player. The list will be empty if there were no people online matching the passed filter.

canSee

public static boolean canSee(Player playerA,
                             Player playerB)
Returns true if player A can see player B in the who list (who, mapwho, users, pdawho, etc.)

Parameters:
playerA - the one doing "who" or whatever. if null, then by default we treat it as a regular player.
playerB - then one who playerA may or may not be able to see
Returns:
true if playerA can see playerB

printPDAWhoList

public java.util.List printPDAWhoList(Player agent)
Shows the who-list in narrow form.

Parameters:
agent - the person who wants to know (must be non-null)
Returns:
a List of lines to print, one per player that the agent can see. Always at least includes the agent.

printPlayerEntry

public static java.lang.String printPlayerEntry(Player p)
Prints a player entry to the string buffer.


printWizardEntry

public static java.lang.String printWizardEntry(Player p)
Prints a wizard line.


printPDAPlayerEntry

public static java.lang.String printPDAPlayerEntry(Player p)
Prints a player entry to the string buffer.


printPDAWizardEntry

public static java.lang.String printPDAWizardEntry(Player p)
Prints a wizard line in narrow form.