Class games.Battle.shared.comm.PlayerInfo
All Packages Class Hierarchy This Package Previous Next Index
Class games.Battle.shared.comm.PlayerInfo
java.lang.Object
|
+----games.Battle.shared.comm.BattlePacket
|
+----games.Battle.shared.comm.PlayerInfo
- public class PlayerInfo
- extends BattlePacket
PlayerInfo records all of the information about a particular player for
the client and the server. Since the PlayerInfo structure contains a
password, the server must be careful to only send you copies of your
own PlayerInfo structure: the derived WhoInfo is used to transmit info
about other players.
-
PlayerInfo(String, String, String, String)
- Constructs a player info from the information usually given on the
registration screen.
-
PlayerInfo(String, String, String, String, boolean, Rating, boolean, boolean)
- Constructs a player info object from complete information on the
player.
-
PlayerInfo(String)
- Constructs a PlayerInfo object from a string representation that was
obtained by calling toString() on a previous PlayerInfo object.
-
PlayerInfo()
- Construct an empty player info object, ready to be read from an input
stream.
-
asciiDump()
- produce text output for this PlayerInfo
-
catBytes(Vector)
- catBytes takes a vector of byte arrays and concatenates them into
one long byte aray which is then returned to the caller.
-
fromBytes(byte[])
- Converts the given array of bytes into a particular
PlayerInfo.
-
getHandle()
- return the handle of this player.
-
getMail()
- return the email address of this player.
-
getName()
- return the real name of this player.
-
getPassword()
- return the password of this player.
-
getRating()
- return the player's rating.
-
getStrings(byte[])
- Takes in a concatenated list of byte arrays and produces a vector
of strings from it.
-
isWizard()
- returns true if the player is a wizard (administrator)
-
makeBytes(String)
- Converts this PlayerInfo to an array of bytes for
transmission.
-
sameId(PlayerInfo)
- return true if the ID's are identical ignoring case.
-
samePass(PlayerInfo)
- return true if the passwords are identical.
-
setArcade(boolean)
- sets the user's arcade (3D look) preference (on or off)
-
setMail(String)
- set the email address of this player.
-
setName(String)
- set the real name of this player.
-
setPassword(String)
- set the password of this player.
-
setSound(boolean)
- sets the user's sound preference (on or off)
-
toBytes()
- return a byte array that represents this packet.
-
toString()
- convert to a string representation where all the data is in fields
separated by the FIELDSEP character.
-
useArcade()
- returns true if the player wants the client to be arcade-style (3D).
-
useSound()
- returns true if the player wants the client to use sound.
PlayerInfo
public PlayerInfo(String handle,
String name,
String mail,
String pass)
- Constructs a player info from the information usually given on the
registration screen.
PlayerInfo
public PlayerInfo(String handle,
String name,
String mail,
String pass,
boolean wizard,
Rating rating,
boolean sound,
boolean arcade)
- Constructs a player info object from complete information on the
player.
PlayerInfo
public PlayerInfo(String stringRep)
- Constructs a PlayerInfo object from a string representation that was
obtained by calling toString() on a previous PlayerInfo object.
Currently convenient for writing and reading the player file.
- Parameters:
- stringRep - the string representation of this user
PlayerInfo
public PlayerInfo()
- Construct an empty player info object, ready to be read from an input
stream.
makeBytes
protected byte[] makeBytes(String s)
- Converts this PlayerInfo to an array of bytes for
transmission.
catBytes
protected byte[] catBytes(Vector strings)
- catBytes takes a vector of byte arrays and concatenates them into
one long byte aray which is then returned to the caller.
- Parameters:
- strings - the vector of byte arrays to be glued together
toBytes
protected byte[] toBytes()
- return a byte array that represents this packet.
- Overrides:
- toBytes in class BattlePacket
getStrings
protected Vector getStrings(byte data[])
- Takes in a concatenated list of byte arrays and produces a vector
of strings from it. A sentinel is used to distinguish the byte
arrays from the rest of the PlayerInfo packet.
- Parameters:
- data - the byte array that contains data for this packet
fromBytes
protected void fromBytes(byte data[])
- Converts the given array of bytes into a particular
PlayerInfo.
- Parameters:
- data - the array of data to be converted
- Overrides:
- fromBytes in class BattlePacket
sameId
public boolean sameId(PlayerInfo other)
- return true if the ID's are identical ignoring case.
samePass
public boolean samePass(PlayerInfo other)
- return true if the passwords are identical.
asciiDump
public void asciiDump()
- produce text output for this PlayerInfo
getHandle
public String getHandle()
- return the handle of this player.
getPassword
public String getPassword()
- return the password of this player.
getName
public String getName()
- return the real name of this player.
getMail
public String getMail()
- return the email address of this player.
setPassword
public void setPassword(String newpass)
- set the password of this player.
setName
public void setName(String newname)
- set the real name of this player.
setMail
public void setMail(String newmail)
- set the email address of this player.
toString
public String toString()
- convert to a string representation where all the data is in fields
separated by the FIELDSEP character.
- Overrides:
- toString in class Object
getRating
public Rating getRating()
- return the player's rating.
isWizard
public boolean isWizard()
- returns true if the player is a wizard (administrator)
useSound
public boolean useSound()
- returns true if the player wants the client to use sound.
useArcade
public boolean useArcade()
- returns true if the player wants the client to be arcade-style (3D).
setSound
public void setSound(boolean b)
- sets the user's sound preference (on or off)
setArcade
public void setArcade(boolean b)
- sets the user's arcade (3D look) preference (on or off)
All Packages Class Hierarchy This Package Previous Next Index