com.planet_ink.coffee_mud.Common
Class DefaultPlayerAccount

java.lang.Object
  extended by com.planet_ink.coffee_mud.Common.DefaultPlayerAccount
All Implemented Interfaces:
AccountStats, CMCommon, PlayerAccount, CMObject, Modifiable, java.lang.Cloneable, java.lang.Comparable<CMObject>

public class DefaultPlayerAccount
extends java.lang.Object
implements PlayerAccount


Field Summary
protected  long accountExpiration
           
protected  java.lang.String accountName
           
protected  SHashSet<java.lang.String> acctFlags
           
protected static java.lang.String[] CODES
           
protected  java.lang.String email
           
protected  MOB fakePlayerM
           
protected  SHashSet<java.lang.String> friends
           
protected  SHashSet<java.lang.String> ignored
           
protected  long LastDateTime
           
protected  java.lang.String lastIP
           
protected  long lastUpdated
           
protected  java.lang.String notes
           
protected  java.lang.String Password
           
protected  SVector<java.lang.String> players
           
protected  SVector<PlayerLibrary.ThinPlayer> thinPlayers
           
protected  java.lang.String[] xtraValues
           
 
Fields inherited from interface com.planet_ink.coffee_mud.Common.interfaces.PlayerAccount
FLAG_ACCOUNTMENUSOFF, FLAG_ANSI, FLAG_CANEXPORT, FLAG_DESCS, FLAG_MAXCONNSOVERRIDE, FLAG_NOEXPIRE, FLAG_NUMCHARSOVERRIDE
 
Constructor Summary
DefaultPlayerAccount()
           
 
Method Summary
 java.lang.String accountName()
          Returns this accounts name
 void addNewPlayer(MOB mob)
          Adds a new player to this account.
 int compareTo(CMObject o)
           
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
 void delPlayer(MOB mob)
          Removes a player from this account.
 void delPlayer(java.lang.String name)
          Removes a player of this name from this account.
 java.lang.String findPlayer(java.lang.String name)
          Returns the real name if the player is on this account
 long getAccountExpiration()
          If the ACCOUNT system is used, this returns the time, in milis since 1970, that this account will expire (meaning the player will no longer be able to log in)
 MOB getAccountMob()
          Retrieves a fake account mob, for forum and other access systems not directly relayed to gameplay.
protected  int getCodeNum(java.lang.String code)
           
 java.lang.String getEmail()
          Returns the players email address, if available.
 java.util.Set<java.lang.String> getFriends()
          Returns a modifiable HashSet that contains the set of player Names that constitutes this players friends.
 SHashSet<java.lang.String> getHashFrom(java.lang.String str)
           
 java.util.Set<java.lang.String> getIgnored()
          Returns a modifiable HashSet that contains the set of player Names that constitutes this players ignored player list.
 java.util.Enumeration<MOB> getLoadPlayers()
          Return an enumeration of the fully loaded players that belong to this account.
 java.util.Enumeration<java.lang.String> getPlayers()
          Return an enumeration of the players names that belong to this account.
protected  java.lang.String getPrivateList(java.util.Set<java.lang.String> h)
           
 int getSaveStatIndex()
          Returns the index into the stat codes array where extra savable fields begins.
 java.lang.String getStat(java.lang.String code)
          An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders.
 java.lang.String[] getStatCodes()
          Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.
 java.util.Enumeration<PlayerLibrary.ThinPlayer> getThinPlayers()
          Return an enumeration of the semi-loaded players that belong to this account.
 java.lang.String getXML()
          Returns an XML representation of all the data in this object, for persistant storage.
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 void initializeClass()
          Called ONCE after all objects are loaded, but before the map is read in during initialization.
 boolean isSet(java.lang.String flagName)
          Checks whether the given string flag is set for this account.
 boolean isStat(java.lang.String code)
          An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders.
 long lastDateTime()
          The time, in milis since 1970, that the player last logged off.
 java.lang.String lastIP()
          The last IP address this player logged in from.
 long lastUpdated()
          The time, in milis since 1970, that the player was last saved.
 CMObject newInstance()
          Returns a new instance of this class.
 java.lang.String notes()
          Returns the administrative notes entered about this player.
 int numPlayers()
          Returns the number of players this account currently has listed.
 java.lang.String password()
          Returns the players password.
 boolean sameAs(PlayerAccount E)
           
 void setAccountExpiration(long newVal)
          If the ACCOUNT system is used, this sets the time, in milis since 1970, that this account will expire (meaning the player will no longer be able to log in)
 void setAccountName(java.lang.String name)
          Sets this accounts unique name
 void setEmail(java.lang.String newAdd)
          Sets the players email address, if available.
 void setFlag(java.lang.String flagName, boolean setOrUnset)
          Sets or unsets an account-wide flag.
 void setLastDateTime(long C)
          Sets the time, in milis since 1970, that the player last logged off.
 void setLastIP(java.lang.String ip)
          Sets the last IP address this player logged in from.
 void setLastUpdated(long time)
          Sets the time, in milis since 1970, that the player was last saved.
 void setNotes(java.lang.String newnotes)
          Sets the administrative notes entered about this player.
 void setPassword(java.lang.String newPassword)
          Sets the players password.
 void setPlayerNames(java.util.Vector<java.lang.String> names)
          Sets the names of all the players that belong to this account
 void setStat(java.lang.String code, java.lang.String val)
          An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders.
 void setXML(java.lang.String str)
          Restores the data in this object from an XML document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

friends

protected SHashSet<java.lang.String> friends

ignored

protected SHashSet<java.lang.String> ignored

players

protected SVector<java.lang.String> players

thinPlayers

protected SVector<PlayerLibrary.ThinPlayer> thinPlayers

accountName

protected java.lang.String accountName

lastIP

protected java.lang.String lastIP

LastDateTime

protected long LastDateTime

lastUpdated

protected long lastUpdated

email

protected java.lang.String email

Password

protected java.lang.String Password

notes

protected java.lang.String notes

accountExpiration

protected long accountExpiration

xtraValues

protected java.lang.String[] xtraValues

acctFlags

protected SHashSet<java.lang.String> acctFlags

fakePlayerM

protected volatile MOB fakePlayerM

CODES

protected static java.lang.String[] CODES
Constructor Detail

DefaultPlayerAccount

public DefaultPlayerAccount()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, MiscTech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Returns:
the name of this class

getStat

public java.lang.String getStat(java.lang.String code)
Description copied from interface: Modifiable
An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. Values returned are always strings, even if the field itself is numeric or a list.

Specified by:
getStat in interface Modifiable
Parameters:
code - the name of the field to read.
Returns:
the value of the field read
See Also:
Modifiable.getStatCodes()

setStat

public void setStat(java.lang.String code,
                    java.lang.String val)
Description copied from interface: Modifiable
An alternative means of setting the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. The value passed in is always a string, even if the field itself is numeric or a list.

Specified by:
setStat in interface Modifiable
Parameters:
code - the name of the field to set
val - the value to set the field to
See Also:
Modifiable.getStatCodes()

getSaveStatIndex

public int getSaveStatIndex()
Description copied from interface: Modifiable
Returns the index into the stat codes array where extra savable fields begins. This number is always the same as getStatCodes().length unless there are extra fields which need to be saved in xml for generic objects. This method is used by editors for post-build user-defined fields.

Specified by:
getSaveStatIndex in interface Modifiable
Returns:
the index into getStatCodes()
See Also:
Modifiable.getStatCodes(), Modifiable.getStat(String), Modifiable.setStat(String, String)

getStatCodes

public java.lang.String[] getStatCodes()
Description copied from interface: Modifiable
Returns an array of the string names of those fields which are modifiable on this object at run-time by builders.

Specified by:
getStatCodes in interface Modifiable
Returns:
list of the fields which may be set.
See Also:
Modifiable.getStat(String), Modifiable.setStat(String, String)

isStat

public boolean isStat(java.lang.String code)
Description copied from interface: Modifiable
An alternative means of retreiving the values of those fields on this object which are modifiable at run-time by builders. See getStatCodes() for possible values for the code passed to this method. Values returned are always strings, even if the field itself is numeric or a list.

Specified by:
isStat in interface Modifiable
Parameters:
code - the name of the field to read.
Returns:
true if the code is a real value, false otherwise
See Also:
Modifiable.getStatCodes()

getCodeNum

protected int getCodeNum(java.lang.String code)

sameAs

public boolean sameAs(PlayerAccount E)

newInstance

public CMObject newInstance()
Description copied from interface: CMObject
Returns a new instance of this class.

Specified by:
newInstance in interface CMObject
Returns:
a new instance of this class

initializeClass

public void initializeClass()
Description copied from interface: CMObject
Called ONCE after all objects are loaded, but before the map is read in during initialization.

Specified by:
initializeClass in interface CMObject

copyOf

public CMObject copyOf()
Description copied from interface: CMObject
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.

Specified by:
copyOf in interface CMObject
Returns:
a clone of this object

lastIP

public java.lang.String lastIP()
Description copied from interface: AccountStats
The last IP address this player logged in from.

Specified by:
lastIP in interface AccountStats
Returns:
the last IP address this player logged in from.
See Also:
AccountStats.setLastIP(String)

setLastIP

public void setLastIP(java.lang.String ip)
Description copied from interface: AccountStats
Sets the last IP address this player logged in from.

Specified by:
setLastIP in interface AccountStats
Parameters:
ip - the last IP address this player logged in from.
See Also:
AccountStats.lastIP()

getEmail

public java.lang.String getEmail()
Description copied from interface: AccountStats
Returns the players email address, if available.

Specified by:
getEmail in interface AccountStats
Returns:
the players email address, if available.
See Also:
AccountStats.setEmail(String)

setEmail

public void setEmail(java.lang.String newAdd)
Description copied from interface: AccountStats
Sets the players email address, if available.

Specified by:
setEmail in interface AccountStats
Parameters:
newAdd - the players email address, if available.
See Also:
AccountStats.getEmail()

lastUpdated

public long lastUpdated()
Description copied from interface: AccountStats
The time, in milis since 1970, that the player was last saved.

Specified by:
lastUpdated in interface AccountStats
Returns:
the time, in milis since 1970, that the player was last saved.
See Also:
AccountStats.setLastUpdated(long)

setLastUpdated

public void setLastUpdated(long time)
Description copied from interface: AccountStats
Sets the time, in milis since 1970, that the player was last saved.

Specified by:
setLastUpdated in interface AccountStats
Parameters:
time - the time, in milis since 1970, that the player was last saved.
See Also:
AccountStats.lastUpdated()

lastDateTime

public long lastDateTime()
Description copied from interface: AccountStats
The time, in milis since 1970, that the player last logged off.

Specified by:
lastDateTime in interface AccountStats
Returns:
time, in milis since 1970, that the player last logged off.
See Also:
AccountStats.setLastDateTime(long)

setLastDateTime

public void setLastDateTime(long C)
Description copied from interface: AccountStats
Sets the time, in milis since 1970, that the player last logged off.

Specified by:
setLastDateTime in interface AccountStats
Parameters:
C - the time, in milis since 1970, that the player last logged off.
See Also:
AccountStats.lastDateTime()

password

public java.lang.String password()
Description copied from interface: AccountStats
Returns the players password.

Specified by:
password in interface AccountStats
Returns:
the players password.
See Also:
AccountStats.setPassword(String)

setPassword

public void setPassword(java.lang.String newPassword)
Description copied from interface: AccountStats
Sets the players password.

Specified by:
setPassword in interface AccountStats
Parameters:
newPassword - the players password.
See Also:
AccountStats.password()

notes

public java.lang.String notes()
Description copied from interface: AccountStats
Returns the administrative notes entered about this player.

Specified by:
notes in interface AccountStats
Returns:
the administrative notes entered about this player.
See Also:
AccountStats.setNotes(String)

setNotes

public void setNotes(java.lang.String newnotes)
Description copied from interface: AccountStats
Sets the administrative notes entered about this player.

Specified by:
setNotes in interface AccountStats
Parameters:
newnotes - the administrative notes entered about this player.
See Also:
AccountStats.notes()

getHashFrom

public SHashSet<java.lang.String> getHashFrom(java.lang.String str)

getFriends

public java.util.Set<java.lang.String> getFriends()
Description copied from interface: AccountStats
Returns a modifiable HashSet that contains the set of player Names that constitutes this players friends.

Specified by:
getFriends in interface AccountStats
Returns:
a set of player friend names

getIgnored

public java.util.Set<java.lang.String> getIgnored()
Description copied from interface: AccountStats
Returns a modifiable HashSet that contains the set of player Names that constitutes this players ignored player list.

Specified by:
getIgnored in interface AccountStats
Returns:
a set of player ignored player list Names

getAccountMob

public MOB getAccountMob()
Description copied from interface: PlayerAccount
Retrieves a fake account mob, for forum and other access systems not directly relayed to gameplay.

Specified by:
getAccountMob in interface PlayerAccount
Returns:
mob the fake player.

getPrivateList

protected java.lang.String getPrivateList(java.util.Set<java.lang.String> h)

getXML

public java.lang.String getXML()
Description copied from interface: AccountStats
Returns an XML representation of all the data in this object, for persistant storage.

Specified by:
getXML in interface AccountStats
Returns:
an XML representation of all the data in this object
See Also:
AccountStats.setXML(String)

setXML

public void setXML(java.lang.String str)
Description copied from interface: AccountStats
Restores the data in this object from an XML document.

Specified by:
setXML in interface AccountStats
Parameters:
str - an XML representation of all the data in this object
See Also:
AccountStats.getXML()

getAccountExpiration

public long getAccountExpiration()
Description copied from interface: AccountStats
If the ACCOUNT system is used, this returns the time, in milis since 1970, that this account will expire (meaning the player will no longer be able to log in)

Specified by:
getAccountExpiration in interface AccountStats
Returns:
the time, in milis, that this player expires.
See Also:
AccountStats.setAccountExpiration(long)

setAccountExpiration

public void setAccountExpiration(long newVal)
Description copied from interface: AccountStats
If the ACCOUNT system is used, this sets the time, in milis since 1970, that this account will expire (meaning the player will no longer be able to log in)

Specified by:
setAccountExpiration in interface AccountStats
Parameters:
newVal - the time, in milis, that this player expires.
See Also:
AccountStats.getAccountExpiration()

accountName

public java.lang.String accountName()
Description copied from interface: PlayerAccount
Returns this accounts name

Specified by:
accountName in interface PlayerAccount
Returns:
this accounts name

setAccountName

public void setAccountName(java.lang.String name)
Description copied from interface: PlayerAccount
Sets this accounts unique name

Specified by:
setAccountName in interface PlayerAccount
Parameters:
name - the accounts name

addNewPlayer

public void addNewPlayer(MOB mob)
Description copied from interface: PlayerAccount
Adds a new player to this account.

Specified by:
addNewPlayer in interface PlayerAccount
Parameters:
mob - the new player to add.

findPlayer

public java.lang.String findPlayer(java.lang.String name)
Description copied from interface: PlayerAccount
Returns the real name if the player is on this account

Specified by:
findPlayer in interface PlayerAccount
Parameters:
name - the name look for check
Returns:
real name if it exists and null otherwise

delPlayer

public void delPlayer(java.lang.String name)
Description copied from interface: PlayerAccount
Removes a player of this name from this account.

Specified by:
delPlayer in interface PlayerAccount
Parameters:
name - the name of the player to remove.

delPlayer

public void delPlayer(MOB mob)
Description copied from interface: PlayerAccount
Removes a player from this account. This is typically a precursor to deleting the player.

Specified by:
delPlayer in interface PlayerAccount
Parameters:
mob - the player to delete.

getLoadPlayers

public java.util.Enumeration<MOB> getLoadPlayers()
Description copied from interface: PlayerAccount
Return an enumeration of the fully loaded players that belong to this account.

Specified by:
getLoadPlayers in interface PlayerAccount
Returns:
an enumeration of player mob objects

getThinPlayers

public java.util.Enumeration<PlayerLibrary.ThinPlayer> getThinPlayers()
Description copied from interface: PlayerAccount
Return an enumeration of the semi-loaded players that belong to this account.

Specified by:
getThinPlayers in interface PlayerAccount
Returns:
an enumeration of thinplayer objects

getPlayers

public java.util.Enumeration<java.lang.String> getPlayers()
Description copied from interface: PlayerAccount
Return an enumeration of the players names that belong to this account.

Specified by:
getPlayers in interface PlayerAccount
Returns:
an enumeration of player names

setPlayerNames

public void setPlayerNames(java.util.Vector<java.lang.String> names)
Description copied from interface: PlayerAccount
Sets the names of all the players that belong to this account

Specified by:
setPlayerNames in interface PlayerAccount
Parameters:
names - the names of the players

numPlayers

public int numPlayers()
Description copied from interface: PlayerAccount
Returns the number of players this account currently has listed.

Specified by:
numPlayers in interface PlayerAccount
Returns:
the number of players

isSet

public boolean isSet(java.lang.String flagName)
Description copied from interface: PlayerAccount
Checks whether the given string flag is set for this account.

Specified by:
isSet in interface PlayerAccount
Parameters:
flagName - the flag name
Returns:
true if it is set, false if not
See Also:
PlayerAccount.setFlag(String, boolean)

setFlag

public void setFlag(java.lang.String flagName,
                    boolean setOrUnset)
Description copied from interface: PlayerAccount
Sets or unsets an account-wide flag.

Specified by:
setFlag in interface PlayerAccount
Parameters:
flagName - the flag name
setOrUnset - true to set it, false to unset
See Also:
PlayerAccount.isSet(String)

compareTo

public int compareTo(CMObject o)
Specified by:
compareTo in interface java.lang.Comparable<CMObject>