com.planet_ink.coffee_mud.Commands.interfaces
Interface Command

All Superinterfaces:
java.lang.Cloneable, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
Above, Account, Achievements, Activate, Affect, AFK, Aft, After, AHelp, Alias, Announce, ANSI, Areas, As, At, ATopics, Auction, AutoAffects, AutoAssist, AutoDraw, AutoExits, Autoforward, AutoGold, AutoGuard, AutoImprovement, AutoInvoke, AutoLoot, AutoMap, AutoMelee, AutoNotify, AutoRun, AutoWeather, Ban, Beacon, Below, Bid, Boot, Borrow, Brief, Buy, Catalog, Channel, Channels, Chants, ChanWho, CharGen, ClanAccept, ClanApply, ClanAssign, ClanCreate, ClanDeclare, ClanDetails, ClanDonateSet, ClanExile, ClanHomeSet, ClanKills, ClanList, ClanMorgueSet, ClanPremise, ClanPVPKills, ClanQual, ClanReject, ClanResign, ClanTax, ClanVote, ClanWho, Cloak, Close, ColorSet, CommandJournal, Commands, Compare, Compress, Config, Consider, Copy, Crawl, Create, Credits, Deactivate, DeferCmd, Deities, Deposit, Description, Destroy, Deviations, Dig, Disembark, Dismount, Display, Down, Draw, Dress, DrinkCmd, Drop, Duel, DumpFile, East, Eat, Email, Emote, Empty, Enter, Equipment, Every, Examine, Exits, Experience, Expertises, Expire, Export, FactionList, Feed, Fill, Fire, Flee, Follow, Foreward, Formation, Friends, Gain, Gait, GConsider, Generate, Get, Give, GModify, Go, Goto, Group, GTell, Help, HelpList, Hire, Hold, I3Cmd, Ignore, IMC2, Import, Inventory, JConsole, JRun, Kill, Knock, Languages, Learn, Leave, LineWrap, Link, ListCmd, Load, Lock, Logoff, Look, Merge, MetaMsgCommand, Modify, Mood, MOTD, Mount, MPRun, MXP, NoANSI, NoBattleSpam, NoChannel, NoFollow, NOMXP, NoPurge, North, Northeast, Northwest, NoSounds, NoTeach, Open, Order, OutFit, Package, PageBreak, Password, Pause, PlayerKill, PollCmd, Poof, Portside, Pose, Possess, Pour, Practice, Prayers, PreviousCmd, Prompt, Pull, Purge, Push, Put, Qualify, Questwins, Quiet, Quit, Read, Rebuke, Remort, 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, Starboard, Stat, StdCommand, Switch, SysMsgs, Take, Teach, Tell, Test, Throw, TickTock, Time, Title, Top, Topics, TrailTo, Train, Transfer, TypeCmd, Undress, UnLink, Unload, Unlock, Up, Value, Vassals, Ver, View, Visible, Wake, Wealth, 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?


Method Summary
 double actionsCost(MOB mob, java.util.List<java.lang.String> 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 checkedActionsCost(MOB mob, java.util.List<java.lang.String> cmds)
          Returns the number of actions required to completely activate this command.
 double combatActionsCost(MOB mob, java.util.List<java.lang.String> cmds)
          Returns the number of actions required to completely activate this command.
 boolean execute(MOB mob, java.util.List<java.lang.String> commands, int metaFlags)
          This method actually performs the command, when the given parsed set of command-line words.
 java.lang.Object executeInternal(MOB mob, int metaFlags, java.lang.Object... args)
          This method is used for making "insider" calls to the command.
 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.List<java.lang.String> 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, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

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.List<java.lang.String> 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, List), checkedActionsCost(MOB, List)

combatActionsCost

double combatActionsCost(MOB mob,
                         java.util.List<java.lang.String> 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, List), checkedActionsCost(MOB, List)

checkedActionsCost

double checkedActionsCost(MOB mob,
                          java.util.List<java.lang.String> cmds)
Returns the number of actions required to completely activate this command. A value of 0.0 means perform instantly. This method only should check whether the user is in combat and return a proper value.

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, List), actionsCost(MOB, List)

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.List<java.lang.String> 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, List), securityCheck(MOB)

preExecute

boolean preExecute(MOB mob,
                   java.util.List<java.lang.String> 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 - usually means the player has dropped carrier
See Also:
execute(MOB, List, int)

executeInternal

java.lang.Object executeInternal(MOB mob,
                                 int metaFlags,
                                 java.lang.Object... args)
                                 throws java.io.IOException
This method is used for making "insider" calls to the command. It's parameters and implementation can follow any rules you like. The engine will sometimes use these to make direct calls to the command implementations.

Parameters:
mob - the mob or player issueing the command
metaFlags - flags denoting how the command is being executed
args - a set of object parameters
Returns:
a object response
Throws:
java.io.IOException - usually means the player has dropped carrier