|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsoc.message.SOCMessage
soc.message.SOCPutPiece
public class SOCPutPiece
This message means that a player is asking to place, or has placed, a piece on the board.
Also used when joining a new game or a game in progress, to send the game state so far.
Some game scenarios use villages which aren't owned by any player;
their getPlayerNumber() is -1 in this message.
The messages similar but opposite to this one are SOCCancelBuildRequest
and the very-limited SOCRemovePiece.
| Field Summary | |
|---|---|
private int |
coordinates
the coordinates of the piece |
private java.lang.String |
game
the name of the game |
private int |
pieceType
the type of piece being placed, such as SOCPlayingPiece.CITY |
private int |
playerNumber
the player number of who played the piece, or -1 for non-player-owned SOCPlayingPiece.VILLAGE |
private static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
SOCPutPiece(java.lang.String na,
int pn,
int pt,
int co)
create a PutPiece message |
|
| Method Summary | |
|---|---|
int |
getCoordinates()
|
java.lang.String |
getGame()
Name of game this message is for. |
int |
getPieceType()
|
int |
getPlayerNumber()
|
static SOCPutPiece |
parseDataStr(java.lang.String s)
parse the command string into a PutPiece message |
java.lang.String |
toCmd()
Command string: PUTPIECE sep game sep2 playerNumber sep2 pieceType sep2 coordinates |
static java.lang.String |
toCmd(java.lang.String ga,
int pn,
int pt,
int co)
Command string: PUTPIECE sep game sep2 playerNumber sep2 pieceType sep2 coordinates |
java.lang.String |
toString()
Simple human-readable representation, used for debug purposes. |
| Methods inherited from class soc.message.SOCMessage |
|---|
arrayIntoStringBuf, enumIntoStringBuf, getClassNameShort, getMaximumVersion, getMinimumVersion, getType, isSingleLineAndSafe, isSingleLineAndSafe, toMsg |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface soc.message.SOCMessageForGame |
|---|
getType |
| Field Detail |
|---|
private static final long serialVersionUID
private java.lang.String game
private int pieceType
SOCPlayingPiece.CITY
private int playerNumber
SOCPlayingPiece.VILLAGE
private int coordinates
| Constructor Detail |
|---|
public SOCPutPiece(java.lang.String na,
int pn,
int pt,
int co)
na - name of the gamept - type of playing piece, such as SOCPlayingPiece.CITYpn - player number, or -1 for non-player-owned SOCPlayingPiece.VILLAGEco - coordinates| Method Detail |
|---|
public java.lang.String getGame()
SOCMessageForGamenull if message is in per-game structures or code.
At the server, the message treater dispatches incoming SOCMessageForGames
based on their getGame():
null: Message is ignored
SOCMessage.GAME_NONE: Message is handled by SOCServer itself
GameHandler for that game's type. If no game with that name is found,
the message is ignored.
getGame in interface SOCMessageForGameSOCMessage.GAME_NONEpublic int getPieceType()
SOCPlayingPiece.CITYpublic int getPlayerNumber()
public int getCoordinates()
public java.lang.String toCmd()
toCmd in class SOCMessage
public static java.lang.String toCmd(java.lang.String ga,
int pn,
int pt,
int co)
ga - the name of the gamepn - player number, or -1 for non-player-owned SOCPlayingPiece.VILLAGEpt - type of playing piececo - coordinates
public static SOCPutPiece parseDataStr(java.lang.String s)
s - the String to parse
public java.lang.String toString()
SOCMessage
toString in class SOCMessage
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||