|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.yagurashogi.server.Player
public class Player
This object manages all the information about each connected player.
| Field Summary | |
|---|---|
static int |
GAME
|
static int |
GAME_WAITING
|
static int |
IDLE
|
| Constructor Summary | |
|---|---|
Player(ShogiServer shogiServer,
java.net.Socket sock,
java.lang.String login,
java.lang.String pass)
Creates new player for a user that logged in. |
|
| Method Summary | |
|---|---|
void |
chat(java.lang.String message)
Sends a message from this user to the others. |
void |
enterGame(Game g)
Associates player with chosen game; |
Game |
getGame()
Returns the game that this user plays. |
java.lang.String |
getMessage()
Retrieves any new messages for this user. |
java.lang.String |
getName()
Returns this user's name. |
int |
getState()
Returns the state in which the player currently is. |
boolean |
isAvailable()
Checks if this player wants to be paired up. |
void |
leaveGame()
Makes player ready for a new game. |
void |
remove()
Removes this user from the server. |
void |
send(java.lang.String message)
Sends this user a message. |
void |
setAvailable(boolean avail)
Sets this player's availability for pairing up to a new value. |
void |
setState(int st)
Sets this player's state to a new value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int IDLE
public static final int GAME_WAITING
public static final int GAME
| Constructor Detail |
|---|
public Player(ShogiServer shogiServer,
java.net.Socket sock,
java.lang.String login,
java.lang.String pass)
shogiServer - the server that the user is onsock - the socket through which the communication takes placelogin - the name with which the user logged inpass - password supplied by this user| Method Detail |
|---|
public void enterGame(Game g)
g - the game that this user playspublic void leaveGame()
public Game getGame()
public java.lang.String getName()
public int getState()
public void setState(int st)
st - new state valuepublic void remove()
public boolean isAvailable()
public void setAvailable(boolean avail)
avail - true if the player wants to be paired up, false otherwisepublic void send(java.lang.String message)
message - the text to be deliveredpublic java.lang.String getMessage()
public void chat(java.lang.String message)
message - message's content
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||