Class Command

java.lang.Object
VASSAL.command.Command
Direct Known Subclasses:
AddPiece, AddSecretNoteCommand, AlertCommand, BasicLogger.LogCommand, BasicLogger.UndoCommand, BoardPicker.SetBoards, ChangePiece, ChangePropertyCommand, Chatter.DisplayText, ConditionalCommand, Deck.LoadDeckCommand, EventLog.StoreEvents, FlareCommand, GameState.SetupCommand, GlobalProperty.SetGlobalProperty, InviteCommand, LOS_Thread.LOSCommand, ModuleExtension.RegCmd, MovePiece, NewGameIndicator.MarkGameNotNew, NotesWindow.SetPublicNote, NotesWindow.SetScenarioNote, NullCommand, ObscurableOptions.SetAllowed, PlayAudioClipCommand, PlayerRoster.Add, PlayerRoster.Remove, PrivMsgCommand, RemovePiece, ScenarioPropertiesOptionTab.LockScenarioOptionsTab, SetPersistentPropertyCommand, SetPrivateTextCommand, SoundEncoder.Cmd, SpecialDiceButton.ShowResults, SynchCommand, TextClient.ShowText, TurnTracker.SetTurn

public abstract class Command extends Object
A Command represents an action that needs to be transmitted from one client to another - any action that could change the game state of a multiplayer game should be encapsulated in a Command object. When performing actions during the game, corresponding Commands will be logged in the correct logfile and/or sent to other players through the server. CommandEncoders then serialise (CommandEncoder.encode(VASSAL.command.Command)) and deserialise (CommandEncoder.decode(java.lang.String)) Commands to and from an ascii based representation. Commands are encoded by the generated client prior to being sent across network or saved in a log or save file. Commands are decoded by the receiving client on receipt from the network or on reading from a log or save file. Save game creation is a special case where every GameComponent is asked to generate a Command that when executed will cause itself to be recreated in its present state. The execute() method implements the execution of the command and is called by the receiving client after building the Command using decode. The execute method is sometimes called on the generating client but does not need to be if the Command is being created to encapsulate something that has already happened on the generating client. Commands can be strung together into compound commands with the append(VASSAL.command.Command) method. Although Commands can be linked into compound commands this way, each CommandEncoder need only handle single (not compound) commands.