com.planet_ink.coffee_mud.Commands.interfaces
Interface Command

All Superinterfaces:
java.lang.Cloneable, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
Activate, Affect, AFK, After, AHelp, Alias, Announce, ANSI, Areas, As, At, ATopics, Auction, AutoAffects, AutoAssist, AutoDraw, AutoExits, Autoforward, AutoGold, AutoGuard, AutoImprovement, AutoInvoke, AutoLoot, AutoMelee, AutoNotify, AutoRun, AutoWeather, Ban, Beacon, Bid, Boot, Borrow, Brief, Buy, Catalog, Channel, Channels, Chants, ChanWho, CharGen, ClanAccept, ClanApply, ClanAssign, ClanCreate, ClanDeclare, ClanDetails, ClanDonateSet, ClanExile, ClanHomeSet, ClanList, ClanMorgueSet, ClanPremise, ClanQual, ClanReject, ClanResign, ClanTax, ClanVote, ClanWho, Cloak, Close, ColorSet, CommandJournal, Commands, Compare, Compress, Config, Consider, Copy, Crawl, Create, Credits, Deactivate, Deities, Deposit, Description, Destroy, Deviations, Dismount, Display, Down, Draw, Dress, DrinkCmd, Drop, DumpFile, East, Eat, Email, Emote, Empty, Enter, Equipment, Examine, Exits, Expertises, Expire, Export, FactionList, Feed, Fill, Fire, Flee, Follow, Formation, Friends, Gain, GConsider, Generate, Get, Give, GModify, Go, Goto, Group, GTell, Help, HelpList, Hire, Hold, I3Cmd, Ignore, IMC2, Import, Inventory, JRun, Kill, Knock, Languages, Learn, LineWrap, Link, List, ListSessions, Load, Lock, Look, Merge, Modify, Mood, MOTD, Mount, MXP, NoANSI, NoChannel, NoFollow, NOMXP, NoPurge, North, Northeast, Northwest, NoSounds, NoTeach, Open, Order, OutFit, Package, Password, Pause, PlayerKill, PollCmd, Poof, Possess, Pour, Practice, Prayers, PreviousCmd, Prompt, Pull, Purge, Push, Put, Qualify, Questwins, Quiet, Quit, Read, Rebuke, Remove, Replay, Reply, Report, Reset, Restring, Retire, Rules, Run, Save, Say, Score, Sell, Serve, Sheath, Shell, Shutdown, Sit, Skills, Sleep, Sniff, Snoop, SocialsCmd, Songs, Sounds, South, Southeast, Southwest, Spells, Split, Stand, Stat, StdCommand, SysMsgs, Take, Teach, Tell, Test, Throw, TickTock, Time, Title, Topics, TrailTo, Train, Transfer, Undress, UnLink, Unload, Unlock, Up, Value, Vassals, Ver, View, Visible, Wake, Wear, Weather, West, Where, Whisper, Who, WhoIs, Wield, WillQualify, Wimpy, Withdraw, WizEmote, WizInv, WizList, Xml, Yell

public interface Command
extends CMObject

A Command is a thing entered on the command line by players. It performs some function, right?


Field Summary
static int METAFLAG_AS
          constant mask for the metaflags parameter for execute and preexecute, means being forced with AS
static int METAFLAG_FORCED
          constant mask for the metaflags parameter for execute and preexecute, means being forced with spells
static int METAFLAG_MPFORCED
          constant mask for the metaflags parameter for execute and preexecute, means being mpforced
static int METAFLAG_ORDER
          constant mask for the metaflags parameter for execute and preexecute, means being ordered
static int METAFLAG_POSSESSED
          constant mask for the metaflags parameter for execute and preexecute, means being possessed
static int METAFLAG_SNOOPED
          constant mask for the metaflags parameter for execute and preexecute, means being snooped
 
Method Summary
 double actionsCost(MOB mob, java.util.Vector cmds)
          Returns the number of actions required to completely activate this command.
 boolean canBeOrdered()
          Whether the a group leader or charmer can order their followers to do this command.
 double combatActionsCost(MOB mob, java.util.Vector cmds)
          Returns the number of actions required to completely activate this command.
 boolean execute(MOB mob, java.util.Vector commands, int metaFlags)
          This method actually performs the command, when the given parsed set of command-line words.
 java.lang.String[] getAccessWords()
          Returns the set of command words, with the most public one first, that are entered by the user to initiate this command.
 boolean preExecute(MOB mob, java.util.Vector commands, int metaFlags, int secondsElapsed, double actionsRemaining)
          This method is only called when the mob invoking this command does not have enough actions to complete it immediately.
 boolean securityCheck(MOB mob)
          Whether this command is available to the given player
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

METAFLAG_MPFORCED

static final int METAFLAG_MPFORCED
constant mask for the metaflags parameter for execute and preexecute, means being mpforced

See Also:
Constant Field Values

METAFLAG_ORDER

static final int METAFLAG_ORDER
constant mask for the metaflags parameter for execute and preexecute, means being ordered

See Also:
Constant Field Values

METAFLAG_POSSESSED

static final int METAFLAG_POSSESSED
constant mask for the metaflags parameter for execute and preexecute, means being possessed

See Also:
Constant Field Values

METAFLAG_SNOOPED

static final int METAFLAG_SNOOPED
constant mask for the metaflags parameter for execute and preexecute, means being snooped

See Also:
Constant Field Values

METAFLAG_AS

static final int METAFLAG_AS
constant mask for the metaflags parameter for execute and preexecute, means being forced with AS

See Also:
Constant Field Values

METAFLAG_FORCED

static final int METAFLAG_FORCED
constant mask for the metaflags parameter for execute and preexecute, means being forced with spells

See Also:
Constant Field Values
Method Detail

getAccessWords

java.lang.String[] getAccessWords()
Returns the set of command words, with the most public one first, that are entered by the user to initiate this command.

Returns:
the set of command words that the user enters

actionsCost

double actionsCost(MOB mob,
                   java.util.Vector cmds)
Returns the number of actions required to completely activate this command. A value of 0.0 means perform instantly. This method only applies when the user is not in combat.

Parameters:
mob - the mob executing the command, if any
cmds - the parameters to be passed to the command, if any
Returns:
the number of player free actions required to do this
See Also:
combatActionsCost(MOB, Vector)

combatActionsCost

double combatActionsCost(MOB mob,
                         java.util.Vector cmds)
Returns the number of actions required to completely activate this command. A value of 0.0 means perform instantly. This method only applies when the user is fighting in combat.

Parameters:
mob - the mob executing the command, if any
cmds - the parameters to be passed to the command, if any
Returns:
the number of player free actions required to do this
See Also:
actionsCost(MOB, Vector)

canBeOrdered

boolean canBeOrdered()
Whether the a group leader or charmer can order their followers to do this command.

Returns:
whether this command can be ordered.

securityCheck

boolean securityCheck(MOB mob)
Whether this command is available to the given player

Parameters:
mob - the player mob who might not even know about this command
Returns:
true if the command is available, and false if it is unknown

execute

boolean execute(MOB mob,
                java.util.Vector commands,
                int metaFlags)
                throws java.io.IOException
This method actually performs the command, when the given parsed set of command-line words. The commands list is almost always the set of strings, starting with the access word that triggered the command. Some commands have custom APIs however, that allow almost anything to be in the commands list, or even for the commands to be null. This method is not allowed to be called until the player or mob has satisfied the actionsCost requirements and the securityCheck

Parameters:
mob - the mob or player issueing the command
commands - usually the command words and parameters; a set of strings
metaFlags - flags denoting how the command is being executed
Returns:
whether the command was successfully executed. Is almost meaningless.
Throws:
java.io.IOException - usually means the player has dropped carrier
See Also:
actionsCost(MOB, Vector), securityCheck(MOB)

preExecute

boolean preExecute(MOB mob,
                   java.util.Vector commands,
                   int metaFlags,
                   int secondsElapsed,
                   double actionsRemaining)
                   throws java.io.IOException
This method is only called when the mob invoking this command does not have enough actions to complete it immediately. The method is called when the command is entered, and every second afterwards until the invoker has enough actions to complete it. At completion time, execute is called.

Parameters:
mob - the player or mob invoking the command
commands - the parameters entered for the command (including the trigger word)
metaFlags - flags denoting how the command is being executed
secondsElapsed - 0 at first, and increments every second
actionsRemaining - number of free actions the player is defficient.
Returns:
whether the command should be allowed to go forward. false cancels altogether.
Throws:
java.io.IOException
See Also:
execute(MOB, Vector, int)