|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfreerails.world.player.Player
public class Player
Represents a player within the game. The player model is such that a user can start a client, create a new player on the server and start playing. They can disconnect from the server, which may continue running with other players still active. The server can then save the list of players and be stopped and restarted again, the clients can then authenticate themselves to the server and continue their sessions where they left off. XXX the player is only authenticated when the connection is opened, and subsequent exchanges are not authenticated. TODO implement a more complete authentication system using certificates rather than public keys.
| Nested Class Summary | |
|---|---|
private static class |
Player.WorldPrincipal
A FreerailsPrincipal that is not a player. |
| Field Summary | |
|---|---|
static FreerailsPrincipal |
AUTHORITATIVE
This Principal can be granted all permissions. |
private java.lang.String |
name
Name of the player. |
static FreerailsPrincipal |
NOBODY
This Principal has no permissions. |
private FreerailsPrincipal |
principal
|
private static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
Player(java.lang.String name)
Used by the client to generate a player with a particular name. |
|
Player(java.lang.String name,
int id)
Used by the server to generate a player with a particular name and public key. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
|
java.lang.String |
getName()
|
FreerailsPrincipal |
getPrincipal()
|
int |
hashCode()
|
void |
loadSession(java.io.ObjectInputStream in)
Called by the client to reconstitute the data from a saved game. |
void |
saveSession(java.io.ObjectOutputStream out)
TODO save this player's private data so that they can be re-connected to the server at a later point in time. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private FreerailsPrincipal principal
public static final FreerailsPrincipal AUTHORITATIVE
public static final FreerailsPrincipal NOBODY
private final java.lang.String name
| Constructor Detail |
|---|
public Player(java.lang.String name)
public Player(java.lang.String name,
int id)
| Method Detail |
|---|
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getName()
public void saveSession(java.io.ObjectOutputStream out)
throws java.io.IOException
java.io.IOException
public void loadSession(java.io.ObjectInputStream in)
throws java.io.IOException
java.io.IOExceptionpublic FreerailsPrincipal getPrincipal()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||