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.

Constructor Index

 o PlayerInfo(String, String, String, String)
Constructs a player info from the information usually given on the registration screen.
 o PlayerInfo(String, String, String, String, boolean, Rating, boolean, boolean)
Constructs a player info object from complete information on the player.
 o PlayerInfo(String)
Constructs a PlayerInfo object from a string representation that was obtained by calling toString() on a previous PlayerInfo object.
 o PlayerInfo()
Construct an empty player info object, ready to be read from an input stream.

Method Index

 o asciiDump()
produce text output for this PlayerInfo
 o catBytes(Vector)
catBytes takes a vector of byte arrays and concatenates them into one long byte aray which is then returned to the caller.
 o fromBytes(byte[])
Converts the given array of bytes into a particular PlayerInfo.
 o getHandle()
return the handle of this player.
 o getMail()
return the email address of this player.
 o getName()
return the real name of this player.
 o getPassword()
return the password of this player.
 o getRating()
return the player's rating.
 o getStrings(byte[])
Takes in a concatenated list of byte arrays and produces a vector of strings from it.
 o isWizard()
returns true if the player is a wizard (administrator)
 o makeBytes(String)
Converts this PlayerInfo to an array of bytes for transmission.
 o sameId(PlayerInfo)
return true if the ID's are identical ignoring case.
 o samePass(PlayerInfo)
return true if the passwords are identical.
 o setArcade(boolean)
sets the user's arcade (3D look) preference (on or off)
 o setMail(String)
set the email address of this player.
 o setName(String)
set the real name of this player.
 o setPassword(String)
set the password of this player.
 o setSound(boolean)
sets the user's sound preference (on or off)
 o toBytes()
return a byte array that represents this packet.
 o toString()
convert to a string representation where all the data is in fields separated by the FIELDSEP character.
 o useArcade()
returns true if the player wants the client to be arcade-style (3D).
 o useSound()
returns true if the player wants the client to use sound.

Constructors

 o PlayerInfo
  public PlayerInfo(String handle,
                    String name,
                    String mail,
                    String pass)
Constructs a player info from the information usually given on the registration screen.
 o 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.
 o 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
 o PlayerInfo
  public PlayerInfo()
Construct an empty player info object, ready to be read from an input stream.

Methods

 o makeBytes
  protected byte[] makeBytes(String s)
Converts this PlayerInfo to an array of bytes for transmission.
 o 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
 o toBytes
  protected byte[] toBytes()
return a byte array that represents this packet.
Overrides:
toBytes in class BattlePacket
 o 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
 o 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
 o sameId
  public boolean sameId(PlayerInfo other)
return true if the ID's are identical ignoring case.
 o samePass
  public boolean samePass(PlayerInfo other)
return true if the passwords are identical.
 o asciiDump
  public void asciiDump()
produce text output for this PlayerInfo
 o getHandle
  public String getHandle()
return the handle of this player.
 o getPassword
  public String getPassword()
return the password of this player.
 o getName
  public String getName()
return the real name of this player.
 o getMail
  public String getMail()
return the email address of this player.
 o setPassword
  public void setPassword(String newpass)
set the password of this player.
 o setName
  public void setName(String newname)
set the real name of this player.
 o setMail
  public void setMail(String newmail)
set the email address of this player.
 o 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
 o getRating
  public Rating getRating()
return the player's rating.
 o isWizard
  public boolean isWizard()
returns true if the player is a wizard (administrator)
 o useSound
  public boolean useSound()
returns true if the player wants the client to use sound.
 o useArcade
  public boolean useArcade()
returns true if the player wants the client to be arcade-style (3D).
 o setSound
  public void setSound(boolean b)
sets the user's sound preference (on or off)
 o 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