|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.freecol.common.networking.Message
net.sf.freecol.common.networking.DiplomacyMessage
public class DiplomacyMessage
The message sent when executing a diplomatic trade.
Nested Class Summary | |
---|---|
static class |
DiplomacyMessage.TradeStatus
A type for the agreement status. |
Constructor Summary | |
---|---|
DiplomacyMessage(Game game,
org.w3c.dom.Element element)
Create a new DiplomacyMessage from a
supplied element. |
|
DiplomacyMessage(Unit unit,
Map.Direction direction,
DiplomaticTrade agreement)
Create a new DiplomacyMessage with the
supplied unit, direction and agreement. |
Method Summary | |
---|---|
DiplomaticTrade |
getAgreement()
Get the agreement (a DiplomaticTrade ) in this message. |
java.lang.String |
getOtherNationName(Player player)
Get the name of this message's other nation as a string. |
Settlement |
getSettlement()
Get the Settlement at which a diplomatic exchange happens. |
Unit |
getUnit()
Get the Unit which began this diplomatic exchange. |
static java.lang.String |
getXMLElementTagName()
The tag name of the root element representing this object. |
org.w3c.dom.Element |
handle(FreeColServer server,
Connection connection)
Handle a "diplomacy"-message. |
boolean |
isAccept()
Does this message indicate agreement to the trade? |
boolean |
isReject()
Does this message indicate rejection of the trade? |
void |
setAccept()
Mark a trade as accepted. |
void |
setAgreement(DiplomaticTrade agreement)
Set the agreement (a DiplomaticTrade ) in this message. |
void |
setReject()
Mark a trade as rejected. |
org.w3c.dom.Element |
toXMLElement()
Convert this DiplomacyMessage to XML. |
Methods inherited from class net.sf.freecol.common.networking.Message |
---|
clientError, createError, createError, createNewDocument, createNewRootElement, getAttribute, getChildElement, getDocument, getFreeColProtocolVersion, getType, hasAttribute, insertAsRoot, isType, setAttribute, setAttribute, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DiplomacyMessage(Unit unit, Map.Direction direction, DiplomaticTrade agreement)
DiplomacyMessage
with the
supplied unit, direction and agreement.
unit
- The Unit
that is spying.direction
- The Direction
the unit is looking.agreement
- The DiplomaticTrade
to make.public DiplomacyMessage(Game game, org.w3c.dom.Element element)
DiplomacyMessage
from a
supplied element.
game
- The Game
this message belongs to.element
- The Element
to use to create the message.Method Detail |
---|
public Unit getUnit()
Unit
which began this diplomatic exchange.
This is a helper routine to be called in-client as it blindly trusts its field.
public Settlement getSettlement()
Settlement
at which a diplomatic exchange happens.
This is a helper routine to be called in-client as it blindly trusts all fields.
public java.lang.String getOtherNationName(Player player)
player
- This nation's player.
public DiplomaticTrade getAgreement()
DiplomaticTrade
) in this message.
public void setAgreement(DiplomaticTrade agreement)
DiplomaticTrade
) in this message.
public boolean isAccept()
public void setAccept()
public boolean isReject()
public void setReject()
public org.w3c.dom.Element handle(FreeColServer server, Connection connection)
server
- The FreeColServer
that handles the message.connection
- The Connection
the message is from.
Element
describing the trade with either
"accept" or "reject" status, null on trade failure,
or an error Element
on outright error.public org.w3c.dom.Element toXMLElement()
toXMLElement
in class Message
public static java.lang.String getXMLElementTagName()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |