Package net.sf.freecol.common.networking
Class MonarchActionMessage
- java.lang.Object
- 
- net.sf.freecol.common.networking.Message
- 
- net.sf.freecol.common.networking.TrivialMessage
- 
- net.sf.freecol.common.networking.AttributeMessage
- 
- net.sf.freecol.common.networking.ObjectMessage
- 
- net.sf.freecol.common.networking.MonarchActionMessage
 
 
 
 
 
- 
 public class MonarchActionMessage extends ObjectMessage The message sent when doing a monarch action.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class net.sf.freecol.common.networking.MessageMessage.MessagePriority
 
- 
 - 
Field SummaryFields Modifier and Type Field Description private static java.lang.StringACTION_TAGprivate static java.lang.StringMONARCH_TAGprivate static java.lang.StringRESULT_TAGstatic java.lang.StringTAGprivate static java.lang.StringTAX_TAG- 
Fields inherited from class net.sf.freecol.common.networking.AttributeMessageattributes
 - 
Fields inherited from class net.sf.freecol.common.networking.TrivialMessagecontinueMessage, disconnectMessage, endTurnMessage, enterRevengeModeMessage, reconnectMessage, requestLaunchMessage, retireMessage, startGameMessage
 - 
Fields inherited from class net.sf.freecol.common.networking.Messagelogger, messagePriorityComparator
 
- 
 - 
Constructor SummaryConstructors Constructor Description MonarchActionMessage(Game game, FreeColXMLReader xr)Create a newMonarchActionMessagefrom a stream.MonarchActionMessage(Monarch.MonarchAction action, StringTemplate template, java.lang.String monarchKey)Create a newMonarchActionMessagewith the given action to be sent to the client to solicit a response.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaiHandler(FreeColServer freeColServer, AIPlayer aiPlayer)AI-side handler for this message.voidclientHandler(FreeColClient freeColClient)Client-side handler for this message.booleancurrentPlayerMessage()Should this message only be sent to a server by the current player?private Monarch.MonarchActiongetAction()Gets the monarch action type of this message.private java.lang.StringgetMonarchKey()Gets the monarch key.Message.MessagePrioritygetPriority()Get the priority of this type of message.private java.lang.BooleangetResult()Gets the result.private intgetTax()Gets the tax amount attached to this message.private StringTemplategetTemplate()Gets the template of this message.ChangeSetserverHandler(FreeColServer freeColServer, ServerPlayer serverPlayer)Server-side handler for this message.MonarchActionMessagesetResult(boolean accept)Sets the result.MonarchActionMessagesetTax(int tax)Sets the tax amount attached to this message.- 
Methods inherited from class net.sf.freecol.common.networking.ObjectMessageappendChild, appendChildren, getChildCount, getChildren, setChildren
 - 
Methods inherited from class net.sf.freecol.common.networking.AttributeMessagecanMerge, getStringAttribute, getStringAttributeMap, hasAttribute, setMergeable, setStringAttribute
 - 
Methods inherited from class net.sf.freecol.common.networking.TrivialMessagegetType, setType
 - 
Methods inherited from class net.sf.freecol.common.networking.MessageclientGeneric, expected, getArrayAttributes, getBooleanAttribute, getChild, getChildren, getEnumAttribute, getIntegerAttribute, getPriorityLevel, igc, igc, invokeAndWait, invokeLater, isEmpty, isType, merge, pgc, pgc, pretty, read, setArrayAttributes, setArrayAttributes, setBooleanAttribute, setEnumAttribute, setIntegerAttribute, setStringAttributeMap, setStringAttributes, setStringAttributes, toString, toXML, writeAttributes, writeChildren
 
- 
 
- 
- 
- 
Field Detail- 
TAGpublic static final java.lang.String TAG - See Also:
- Constant Field Values
 
 - 
ACTION_TAGprivate static final java.lang.String ACTION_TAG - See Also:
- Constant Field Values
 
 - 
MONARCH_TAGprivate static final java.lang.String MONARCH_TAG - See Also:
- Constant Field Values
 
 - 
RESULT_TAGprivate static final java.lang.String RESULT_TAG - See Also:
- Constant Field Values
 
 - 
TAX_TAGprivate static final java.lang.String TAX_TAG - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
MonarchActionMessagepublic MonarchActionMessage(Monarch.MonarchAction action, StringTemplate template, java.lang.String monarchKey) Create a newMonarchActionMessagewith the given action to be sent to the client to solicit a response.- Parameters:
- action- The- MonarchActionto do.
- template- A- StringTemplatedescribing the action.
- monarchKey- The resource key for the monarch image.
 
 - 
MonarchActionMessagepublic MonarchActionMessage(Game game, FreeColXMLReader xr) throws javax.xml.stream.XMLStreamException Create a newMonarchActionMessagefrom a stream.- Parameters:
- game- The- Gamethis message belongs to.
- xr- The- FreeColXMLReaderto read from.
- Throws:
- javax.xml.stream.XMLStreamException- if there is a problem reading the stream.
 
 
- 
 - 
Method Detail- 
getActionprivate Monarch.MonarchAction getAction() Gets the monarch action type of this message.- Returns:
- The monarch action type.
 
 - 
getTemplateprivate StringTemplate getTemplate() Gets the template of this message.- Returns:
- The template.
 
 - 
getMonarchKeyprivate java.lang.String getMonarchKey() Gets the monarch key.- Returns:
- The monarch key.
 
 - 
getTaxprivate int getTax() Gets the tax amount attached to this message.- Returns:
- The tax amount, or negative if none present.
 
 - 
getResultprivate java.lang.Boolean getResult() Gets the result.- Returns:
- The result.
 
 - 
currentPlayerMessagepublic boolean currentPlayerMessage() Should this message only be sent to a server by the current player?- Overrides:
- currentPlayerMessagein class- TrivialMessage
- Returns:
- True if this is a current-player-only message.
 
 - 
getPrioritypublic Message.MessagePriority getPriority() Get the priority of this type of message.- Overrides:
- getPriorityin class- AttributeMessage
- Returns:
- The message priority.
 
 - 
aiHandlerpublic void aiHandler(FreeColServer freeColServer, AIPlayer aiPlayer) AI-side handler for this message. AI handlers always return null. FIXME: One day the FreeColServer should devolve to AIMain.- Overrides:
- aiHandlerin class- TrivialMessage
- Parameters:
- freeColServer- The- FreeColServerhandling the request.
- aiPlayer- The- AIPlayerthe message was sent to.
 
 - 
clientHandlerpublic void clientHandler(FreeColClient freeColClient) Client-side handler for this message. Client handlers always return null.- Overrides:
- clientHandlerin class- TrivialMessage
- Parameters:
- freeColClient- The- FreeColClientto handle this message.
 
 - 
serverHandlerpublic ChangeSet serverHandler(FreeColServer freeColServer, ServerPlayer serverPlayer) Server-side handler for this message.- Overrides:
- serverHandlerin class- TrivialMessage
- Parameters:
- freeColServer- The- FreeColServerhandling the request.
- serverPlayer- The- ServerPlayerthat sent the request.
- Returns:
- A ChangeSetdefining the response.
 
 - 
setTaxpublic MonarchActionMessage setTax(int tax) Sets the tax amount attached to this message.- Parameters:
- tax- The tax amount.
- Returns:
- This message.
 
 - 
setResultpublic MonarchActionMessage setResult(boolean accept) Sets the result.- Parameters:
- accept- The new result.
- Returns:
- This message.
 
 
- 
 
-