|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.common.model.FreeColObject
net.sf.freecol.common.model.FreeColGameObject
net.sf.freecol.common.model.Player
net.sf.freecol.server.model.ServerPlayer
public class ServerPlayer
A Player with additional (server specific) information.
That is: pointers to this player's
Connection and Socket
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class net.sf.freecol.common.model.Player |
|---|
Player.ActivePredicate, Player.GoingToPredicate, Player.PlayerType, Player.Stance, Player.UnitIterator, Player.UnitPredicate |
| Field Summary | |
|---|---|
private boolean |
connected
|
private Connection |
connection
The connection for this player. |
private int |
remainingEmigrants
Remaining emigrants to select due to a fountain of youth |
private java.lang.String |
serverID
|
private java.net.Socket |
socket
The network socket to the player's client. |
| Fields inherited from class net.sf.freecol.common.model.Player |
|---|
canSeeTiles, europe, history, monarch, playerComparator, SCORE_INDEPENDENCE_DECLARED, SCORE_INDEPENDENCE_GRANTED, SCORE_SETTLEMENT_DESTROYED, UNKNOWN_ENEMY |
| Fields inherited from class net.sf.freecol.common.model.FreeColObject |
|---|
ARRAY_SIZE, ID_ATTRIBUTE, ID_ATTRIBUTE_TAG, PARTIAL_ATTRIBUTE |
| Constructor Summary | |
|---|---|
ServerPlayer(Game game,
java.lang.String name,
boolean admin,
boolean ai,
java.net.Socket socket,
Connection connection,
Nation nation)
Creates a new ServerPlayer. |
|
ServerPlayer(Game game,
java.lang.String name,
boolean admin,
java.net.Socket socket,
Connection connection)
Creates a new ServerPlayer. |
|
ServerPlayer(javax.xml.stream.XMLStreamReader in)
|
|
| Method Summary | |
|---|---|
ModelMessage |
cashInTreasureTrain(Unit unit)
Cash in a treasure train. |
void |
claimLand(Tile tile,
Settlement settlement,
int price)
Claim the given land. |
java.util.List<FreeColObject> |
declareIndependence(java.lang.String nationName,
java.lang.String countryName)
Declare independence. |
Connection |
getConnection()
Gets the connection of this player. |
int |
getRemainingEmigrants()
|
static java.lang.String |
getServerAdditionXMLElementTagName()
Returns the tag name of the root element representing this object. |
java.net.Socket |
getSocket()
Gets the socket of this player. |
java.util.List<ModelMessage> |
giveIndependence(ServerPlayer REFplayer)
Gives independence to this player. |
boolean |
hasExplored(Tile tile)
Checks if this Player has explored the given Tile. |
boolean |
isConnected()
Checks if this player is currently connected to the server. |
void |
readFromServerAdditionElement(javax.xml.stream.XMLStreamReader in)
|
void |
resetExploredTiles(Map map)
Resets this player's explored tiles. |
void |
revealMap()
(DEBUG ONLY) Makes the entire map visible. |
void |
setConnected(boolean connected)
Sets the "connected"-status of this player. |
void |
setConnection(Connection connection)
Sets the connection of this player. |
void |
setExplored(Tile tile)
Sets the given tile to be explored by this player and updates the player's information about the tile. |
void |
setExplored(Unit unit)
Sets the tiles within the given Unit's line of
sight to be explored by this player. |
void |
setRemainingEmigrants(int emigrants)
|
void |
toServerAdditionElement(javax.xml.stream.XMLStreamWriter out)
|
java.lang.String |
toString()
Returns the name of this player. |
void |
updateID()
Sets the ID of the super class to be serverID. |
| Methods inherited from class net.sf.freecol.common.model.FreeColGameObject |
|---|
addModelMessage, addModelMessage, addToRemoveElement, dispose, equals, equals, getFreeColGameObject, getFreeColGameObject, getGame, getGameOptions, getIntegerID, hashCode, hasID, isDisposed, isUninitialized, readFromXML, readFromXMLPartialByClass, setFakeID, setGame, setId, toSavedXML, toXML, toXMLImpl, toXMLPartialByClass, updateFreeColGameObject |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private java.net.Socket socket
private Connection connection
private boolean connected
private int remainingEmigrants
private java.lang.String serverID
| Constructor Detail |
|---|
public ServerPlayer(Game game,
java.lang.String name,
boolean admin,
java.net.Socket socket,
Connection connection)
ServerPlayer.
game - The Game this object belongs to.name - The player name.admin - Whether the player is the game administrator or not.socket - The socket to the player's client.connection - The Connection for the above mentioned socket.
public ServerPlayer(Game game,
java.lang.String name,
boolean admin,
boolean ai,
java.net.Socket socket,
Connection connection,
Nation nation)
ServerPlayer.
game - The Game this object belongs to.name - The player name.admin - Whether the player is the game administrator or not.ai - Whether this is an AI player.socket - The socket to the player's client.connection - The Connection for the above mentioned socket.nation - The nation of the Player.
public ServerPlayer(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException| Method Detail |
|---|
public boolean isConnected()
false otherwise.public void setConnected(boolean connected)
connected - Should be true if this player is currently
connected to the server and false otherwise.isConnected()public int getRemainingEmigrants()
public void setRemainingEmigrants(int emigrants)
public void claimLand(Tile tile,
Settlement settlement,
int price)
tile - The Tile to claim.settlement - The Settlement that will own the tile, if any.price - The price to pay for the land, which must agree with
the owner valuation, unless negative which denotes stealing.
public java.util.List<FreeColObject> declareIndependence(java.lang.String nationName,
java.lang.String countryName)
nationName - The new name for the independent nation.countryName - The new name for its residents.public java.util.List<ModelMessage> giveIndependence(ServerPlayer REFplayer)
public ModelMessage cashInTreasureTrain(Unit unit)
unit - The treasure train Unit to cash in.public void resetExploredTiles(Map map)
Units line of sight visible.
The other tiles are made unvisible.
map - The Map to reset the explored tiles on.hasExplored(net.sf.freecol.common.model.Tile)public boolean hasExplored(Tile tile)
Player has explored the given Tile.
hasExplored in class Playertile - The Tile.
Tile has been explored and
false otherwise.public void setExplored(Tile tile)
setExplored in class Playertile - The Tile to set explored.Tile.updatePlayerExploredTile(Player)public void setExplored(Unit unit)
Unit's line of
sight to be explored by this player.
setExplored in class Playerunit - The Unit.setExplored(Tile),
hasExplored(net.sf.freecol.common.model.Tile)public void revealMap()
public java.net.Socket getSocket()
Socket.public Connection getConnection()
Connection.public void setConnection(Connection connection)
connection - The Connection.
public void toServerAdditionElement(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toServerAdditionElement in interface ServerModelObjectjavax.xml.stream.XMLStreamExceptionpublic void updateID()
serverID.
updateID in class FreeColGameObject
public void readFromServerAdditionElement(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromServerAdditionElement in interface ServerModelObjectjavax.xml.stream.XMLStreamExceptionpublic static java.lang.String getServerAdditionXMLElementTagName()
public java.lang.String toString()
Player
toString in class Player
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||