org.starhope.appius.user
Class UserRecord

java.lang.Object
  extended by org.starhope.appius.util.SimpleDataRecord<UserRecord>
      extended by org.starhope.appius.user.UserRecord
All Implemented Interfaces:
com.whirlycott.cache.Cacheable, Serializable, Comparable<UserRecord>, CTime, DataRecord, Copyable<UserRecord>, HasSubversionRevision

public class UserRecord
extends SimpleDataRecord<UserRecord>
implements Copyable<UserRecord>

The record describing an user in the game — whether a theoretical user account (like the System User), an actual human user's account, or an NPC.

Author:
brpocock@star-hope.org
See Also:
Serialized Form

Field Summary
private  UserActiveState active
          Whether the user account is OK (active), canceled, or banned
private  AgeBracket ageGroup
          The age bracket to which this user belongs: currently kid (0-12), teen (13-17), or adult (18+).
private  Date approvedDate
          The date on which the account was approved (by parent) or eMail was validated (by self).
private  AvatarClass avatarClass
          The type of avatar in play
private  Colour baseColour
          The base colour of the avatar
private  Date birthDate
          The user's date of birth.
private  boolean canBetaTest
          True if the user can sign in to a Beta server
private  boolean canContact
          if true, the user has given his/her consent to receive marketing messages by eMail
private  boolean canEnterChatZone
          True if the user can enter a zone where people can chat freely.
private  boolean canEnterMenuZone
          True if the user can enter a zone where dialogue is chosen from menus.
private  boolean canTalk
          True if the user is allowed to type chat.
private  Colour chatBG
          background colour for chat text
private  Colour chatFG
          foreground colour for chat text
private  String dialect
          the dialect of the user's language in which s/he prefers to see messages
private  Date emailPlusDate
          For kids, this is the date on which eMail Plus secondary eMail is sent out.
private  Colour extraColour
          The extra colour of the avatar.
private  String givenName
          the user's actual, given name
private  Inventory inv
          The user's inventory.
private  boolean isEphemeral
          Whether or not changes to the class will be flushed.
private  int kickedByUserID
          The user ID who kicked this user offline.
private  String kickedReasonCode
          The reason that this user is kicked offline or banned.
private  Timestamp kickedUntil
          The date at which the user is no longer kicked offline.
private  String language
          the language in which the user prefers to receive messages
private  String lastZoneName
          the last zone on which the user had been logged on; or, their current zone, if we can see Smartfox from here.
private  String login
          The user's current, active login name.
private  String mail
          the user's eMail address
private  Date mailConfirmed
          the date on which the user's mail address was confirmed (or null, if it hasn't been)
private  Date mailConfirmSent
           the date that eMail confirmation was sent out
private  Timestamp nameApprovedAt
          The timestamp of Lifeguard approval of the user's name (or null, if it hasn't been approved yet)
private  int nameApprovedByUserID
          The user ID of the moderator who approved this user's name
(package private)  Timestamp nameRequestedAt
          The time at which this user entered his/her request for a new name.
protected  boolean needsNaming
          If true, the user hasn't picked a name for this account (but it may have a system-assigned random one), so we need to nag them to pick a name.
private static long nextSerial
          class property for generating unique serials for instances
private  boolean notable
          true, if this is a notable NPC/character
private  boolean parentApprovedName
          Whether the user's parent has approved the name yet.
private  int parentID
          Pointer to the parent of this user, if the user's age bracket is "kid"
private  String passRecoveryA
          answer to the password recovery question
private  String passRecoveryQ
          password recovery question
private  String password
          WRITEME
protected  String referer
          The 1-4 character code representing the source of a referral which resulted in this user signing up.
private  Timestamp registeredAt
          Time when the user originally registered
protected  String requestedName
          The user name which the user has requested, but has not yet been approved.
private  long serial
          unique instance serial number
private static long serialVersionUID
          Java Serialisation Unique ID
protected  int staffLevel
          The level of staff authority possessed by this user.
private  SecurityCapability sysOpCapability
          The security capability to act like a system operator
protected  double travelRate
          The rate of movement (in pixels per second) of this user.
protected  UserHouse userHouse
          The set of rooms in this user's house (and yard).
protected  int userID
          The user's numeric ID, for database purposes.
 
Fields inherited from class org.starhope.appius.util.SimpleDataRecord
myLoader, timeLastChanged, timeLastSaved
 
Constructor Summary
UserRecord()
          Nil constructor.
UserRecord(Date birthDate1, String avatarTitle, String userNameRequest, String passwordAnswer, String passwordQuestion, String password2)
          WRITEME: Document this constructor brpocock@star-hope.org
UserRecord(RecordLoader<UserRecord> userRecordLoader)
          WRITEME: Document this constructor brpocock@star-hope.org
 
Method Summary
 void approveName(AbstractUser abstractUser)
          WRITEME: Document this method brpocock@star-hope.org
private  void assertStaffLevel(int staffLevelNeeded)
          assert that the user should have the requisite staff level; otherwise, throw an exception
 void ban(AbstractUser bannedBy, String bannedReason)
          Ban a user, preventing any future access to the server.
 boolean canApproveSelf()
          If the user is a teen (13+) or adult, they are allowed to approve their own account.
 boolean canBetaTest()
           
 boolean canContact()
          WRITEME: Document this method brpocock@star-hope.org
 boolean canEnterChatZone()
          WRITEME: Document this method brpocock@star-hope.org
 boolean canEnterMenuZone()
          WRITEME: Document this method brpocock@star-hope.org
 boolean canLogIn(String passGuess)
          Determine whether the user can log in with the given password.
 boolean canMakePurchase()
           Only adults are allowed to make purchases.
 boolean canTalk()
          WRITEME: Document this method brpocock@star-hope.org
 boolean checkPassword(String passwordGuess)
           
 UserRecord copyProtoype(UserRecord prototype)
          WRITEME: Document this method brpocock@star-hope.org
 String generateSystemName()
          Generate a new "anonymous user name" for the user.
 int getAge()
          Get the current age of the user.
 AgeBracket getAgeGroup()
           
 Date getApprovedDate()
           
 AvatarClass getAvatarClass()
           
 Colour getBaseColor()
           
 Date getBirthDate()
           
 int getCacheableID()
          Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.
 String getCacheableIdent()
          Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.
 Colour getChatBG()
           
 Colour getChatFG()
           
 BigDecimal getCurrency(Currency ident)
           
 String getDebugName()
          Returns a specific string identifying this user in a convenient form for debugging.
 String getDialect()
           
 String getDisplayName()
           
 Date getEmailPlusDate()
           
 Collection<UserEnrolment> getEnrolments()
          get all enrolments in which this user is enrolled.
 Colour getExtraColor()
           
 String getForgotPasswordAnswer()
          Deprecated. use getPasswordRecoveryAnswer()
 String getForgotPasswordQuestion()
          Deprecated. use getPasswordRecoveryQuestion()
 String getGivenName()
           
 UserHouse getHouse()
           
 Inventory getInv()
           
 int getKickedByUserID()
          get the user ID who kicked this user offline.
 String getKickedReasonCode()
          get the reason code for which the user was kicked offline; see WRITEME?
 Timestamp getKickedUntil()
          WRITEME: Document this method brpocock@star-hope.org
 String getLanguage()
           
 String getLastZoneName()
           
 String getLogin()
           
 String getMail()
           
 Date getMailConfirmed()
           
 Date getMailConfirmSent()
           
 Timestamp getNameApprovedAt()
           
 int getNameApprovedByUserID()
           
 Timestamp getNameRequestedAt()
           
private  Parent getParent()
          WRITEME: Document this method brpocock@star-hope.org
 int getParentID()
          WRITEME: Document this method brpocock@star-hope.org
(package private)  String getPassword()
           
 String getPasswordRecoveryAnswer()
           
 String getPasswordRecoveryQuestion()
           
 String getReferer()
           
 Timestamp getRegisteredAt()
           
 Date getRegisteredDate()
           
 String getRegisteredDateString()
           
 String getRequestedName()
           
 String getResponsibleMail()
           Get the eMail address of a responsible person: either the player, or the parent.
 long getSerial()
          Internal serial number for tracking user records through the cache
 int getStaffLevel()
           
 String getSubversionRevision()
           Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.
private  String getSystemNameAdjective()
           
private  String getSystemNameNoun()
           
 double getTravelRate()
           
 int getUserID()
           
 String getUserNameOrRequest()
          return the user's login name, if they have one; or the name that they have requested, if it hasn't been approved yet.
private  Wallet getWallet()
           
 boolean hasStaffLevel(int staffLevelNeeded)
          Returns true if the user has the asserted staff level, or a staff level which includes it.
 boolean isActive()
           
 boolean isApproved()
          WRITEME: Document this method brpocock@star-hope.org
 boolean isBanned()
           
 boolean isBirthday()
           
 boolean isCanceled()
           
 boolean isEphemeral()
           
 boolean isKicked()
          Returns true if the user has been kicked offline (and the time has not yet elapsed).
 boolean isNotable()
           
 boolean isPaidMember()
           
 boolean isParentApprovedName()
           
 Timestamp kick(AbstractUser kickedBy, String kickedReason, Timestamp allowBack)
          Kick the user offline, until a certain date & time.
 void liftBan(AbstractUser authority)
           
(package private)  AbstractUser myUser()
          find the user backed by this user record
 boolean needsNaming()
           
 boolean needsParent()
          Kid accounts (under 13) require parental confirmation.
 void parentApprovedAccount(boolean whether)
           
 void parentApprovedName(boolean whether)
           
 void requestNewUserName(String userNameRequested)
           Post a request to the lifeguards to get approval of a user name
 void setActive(UserActiveState state)
          Sets the active state to the given state
 AgeBracket setAgeGroup()
          set the age bracket of the user record, based upon the specified date of birth.
 void setAgeGroup(AgeBracket ageGroup1)
           
 void setAgeGroupToSystem()
          Declares this to be an inhuman, ergo ageless, user account.
 void setApproved()
          set the date on which the user's account was approved, to the current time.
 void setApprovedDate(Date date)
           
 void setAvatarClass(AvatarClass avatarClass1)
           
 void setBaseColor(Colour newBaseColor)
           
 void setBirthDate(Date birthDate1)
           
 void setCanBetaTest(boolean canBetaTest1)
           
 void setCanContact(boolean b)
          set whether the user acquiesces to be contacted
 void setCanEnterChatZone(boolean newCanEnterChatZone)
           
 void setCanEnterMenuZone(boolean newCanEnterMenuZone)
           
 void setCanTalk(boolean newCanTalk)
           
 void setChatBG(Colour newChatBG)
           
 void setChatFG(Colour newChatFG)
           
 void setCurrency(Currency units, BigDecimal bigDecimal)
          set the user's quantity of currency of a given type
 void setCurrencyIfUnknown(Currency units, BigDecimal bigDecimal)
          set the user's currency of a given type, only if it is not already known
 void setEmailPlusDate(Date emailPlusDate1)
           
 void setEphemeral(boolean newEphemeral)
           
 void setExtraColor(Colour newExtraColor)
           
 void setGivenName(String newName)
           
 void setKickedByUserID(int kickerID)
           
 void setKickedReasonCode(String reason)
           
 void setKickedUntil(Timestamp kickedUntilTime)
           
 void setLanguage(String newLanguage, String newDialect)
           
 void setLastZoneName(String lastZoneName1)
           
 void setLogin(String newLogin)
          set the user's login name
 void setMail(String newMail)
           
 void setMailConfirmed(Date mailConfirmed1)
          Sets the user capabilities to allow talking, and permits the user entry into both chat zones and menu-chat-only zones.
 void setMailConfirmSent(Date dateConfirmationSent)
           
 void setMailConfirmSent(long when)
           
 void setNameApprovedByUserID(int userWhoApproved)
           
 void setNeedsNaming(boolean needsNaming1)
           
 void setNotable(boolean really)
           
 void setParentApprovedName(boolean parentApprovedName1)
           
(package private)  void setParentID(int id)
          WRITEME: Document this method brpocock@star-hope.org
 void setPassword(String newPass)
          WRITEME WRITEME: Document this method brpocock@star-hope.org
 void setPasswordRecovery(String question, String answer)
          Set the question & answer pair to be used to trigger forgotten password recovery
 void setReferer(String theReferer)
           Set the referrer from whom we were sent this new user.
 void setRegisteredAt(Timestamp newRegisteredAt)
           
 void setRequestedName(String requestedName1)
           
 void setStaffLevel(int staffLevel1)
           
 void setTravelRate(double travelRate1)
           
 void setTravelRatePrivately(double rate)
          WRITEME: Document this method brpocock@star-hope.org
 void setUserID(int userID1)
           
 String toString()
           
 
Methods inherited from class org.starhope.appius.util.SimpleDataRecord
changed, checkStale, compareTo, equals, finalize, getRecordLoader, getTimeLastChanged, getTimeLastSaved, hashCode, isBeingLoaded, markAsLoaded, markAsSaved, markForReload, onRemove, onRetrieve, onStore, save, setRecordLoader
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

nextSerial

private static long nextSerial
class property for generating unique serials for instances


serialVersionUID

private static final long serialVersionUID
Java Serialisation Unique ID

See Also:
Constant Field Values

active

private UserActiveState active
Whether the user account is OK (active), canceled, or banned


ageGroup

private AgeBracket ageGroup
The age bracket to which this user belongs: currently kid (0-12), teen (13-17), or adult (18+). Computed from birth date periodically and cached.


approvedDate

private Date approvedDate
The date on which the account was approved (by parent) or eMail was validated (by self). Either way, it's basically eMail validation, but just differs in who gets the mail. The date on which the account was approved (by parent) or eMail was validated (by self). Either way, it's basically eMail validation, but just differs in who gets the mail.


avatarClass

private AvatarClass avatarClass
The type of avatar in play


baseColour

private Colour baseColour
The base colour of the avatar


birthDate

private Date birthDate
The user's date of birth. Required, COPPA.


canBetaTest

private boolean canBetaTest
True if the user can sign in to a Beta server


canContact

private boolean canContact
if true, the user has given his/her consent to receive marketing messages by eMail


canEnterChatZone

private boolean canEnterChatZone
True if the user can enter a zone where people can chat freely. Lightning in Tootsville.


canEnterMenuZone

private boolean canEnterMenuZone
True if the user can enter a zone where dialogue is chosen from menus. Hearts in Tootsville.


canTalk

private boolean canTalk
True if the user is allowed to type chat.


chatBG

private Colour chatBG
background colour for chat text


chatFG

private Colour chatFG
foreground colour for chat text


dialect

private String dialect
the dialect of the user's language in which s/he prefers to see messages


emailPlusDate

private Date emailPlusDate
For kids, this is the date on which eMail Plus secondary eMail is sent out. This may be past or future.


extraColour

private Colour extraColour
The extra colour of the avatar. For Master Toot (Amphibious) this is the nose/highlight colour


givenName

private String givenName
the user's actual, given name


inv

private Inventory inv
The user's inventory. Note that the inventory is not automatically instantiated at user construction; it is opportunistically loaded later.


isEphemeral

private boolean isEphemeral
Whether or not changes to the class will be flushed. True: Do not flush False: Flush


kickedByUserID

private int kickedByUserID
The user ID who kicked this user offline. (or -1)


kickedReasonCode

private String kickedReasonCode
The reason that this user is kicked offline or banned.


kickedUntil

private Timestamp kickedUntil
The date at which the user is no longer kicked offline. For banned users, this is Timestamp ( Long.MAX_LONG ), which means the universe should end first.


language

private String language
the language in which the user prefers to receive messages


lastZoneName

private String lastZoneName
the last zone on which the user had been logged on; or, their current zone, if we can see Smartfox from here.


login

private String login
The user's current, active login name.


mail

private String mail
the user's eMail address


mailConfirmed

private Date mailConfirmed
the date on which the user's mail address was confirmed (or null, if it hasn't been)


mailConfirmSent

private Date mailConfirmSent

the date that eMail confirmation was sent out

XXX: save in database


nameApprovedAt

private Timestamp nameApprovedAt
The timestamp of Lifeguard approval of the user's name (or null, if it hasn't been approved yet)


nameApprovedByUserID

private int nameApprovedByUserID
The user ID of the moderator who approved this user's name


nameRequestedAt

Timestamp nameRequestedAt
The time at which this user entered his/her request for a new name.


needsNaming

protected boolean needsNaming
If true, the user hasn't picked a name for this account (but it may have a system-assigned random one), so we need to nag them to pick a name.


notable

private boolean notable
true, if this is a notable NPC/character


parentApprovedName

private boolean parentApprovedName
Whether the user's parent has approved the name yet.


parentID

private int parentID
Pointer to the parent of this user, if the user's age bracket is "kid"


passRecoveryA

private String passRecoveryA
answer to the password recovery question


passRecoveryQ

private String passRecoveryQ
password recovery question


password

private String password
WRITEME


referer

protected String referer
The 1-4 character code representing the source of a referral which resulted in this user signing up. Referrer (referer) codes are assigned in the M&B web site to “brand” users for life based upon who caused them to sign up with the site.


registeredAt

private Timestamp registeredAt
Time when the user originally registered


requestedName

protected String requestedName
The user name which the user has requested, but has not yet been approved.


serial

private final long serial
unique instance serial number


staffLevel

protected int staffLevel
The level of staff authority possessed by this user.


sysOpCapability

private final SecurityCapability sysOpCapability
The security capability to act like a system operator


travelRate

protected double travelRate
The rate of movement (in pixels per second) of this user.


userHouse

protected UserHouse userHouse
The set of rooms in this user's house (and yard). Special values: 0 is the first room (everyone gets it for free), and 1 is the yard (lot).


userID

protected int userID
The user's numeric ID, for database purposes.

Constructor Detail

UserRecord

public UserRecord()
Nil constructor. Note that birthDate MUST be set before the record can be entered into the database.


UserRecord

public UserRecord(Date birthDate1,
                  String avatarTitle,
                  String userNameRequest,
                  String passwordAnswer,
                  String passwordQuestion,
                  String password2)
           throws AlreadyUsedException,
                  ForbiddenUserException
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
birthDate1 - WRITEME
avatarTitle - WRITEME
userNameRequest - WRITEME
password2 -
passwordQuestion -
passwordAnswer -
Throws:
ForbiddenUserException - WRITEME
AlreadyUsedException - WRITEME

UserRecord

public UserRecord(RecordLoader<UserRecord> userRecordLoader)
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
userRecordLoader - loader
Method Detail

approveName

public void approveName(AbstractUser abstractUser)
                 throws PrivilegeRequiredException,
                        AlreadyUsedException
WRITEME: Document this method brpocock@star-hope.org

Parameters:
abstractUser - WRITEME
Throws:
PrivilegeRequiredException - WRITEME
AlreadyUsedException - if the user's name has been used by someone else already

assertStaffLevel

private void assertStaffLevel(int staffLevelNeeded)
                       throws PrivilegeRequiredException
assert that the user should have the requisite staff level; otherwise, throw an exception

Parameters:
staffLevelNeeded - WRITEME
Throws:
PrivilegeRequiredException - WRITEME

ban

public void ban(AbstractUser bannedBy,
                String bannedReason)
         throws PrivilegeRequiredException
Ban a user, preventing any future access to the server.

Parameters:
bannedBy - The moderator by which the user was banned.
bannedReason - the reason for which the user was banned
Throws:
PrivilegeRequiredException - if the user does not have moderator-level (or better) privileges

canApproveSelf

public boolean canApproveSelf()
If the user is a teen (13+) or adult, they are allowed to approve their own account. This is a boolean test for that fact.

Returns:
true, if the user is permitted to approve their own account (via their own eMail address). False, if they require parent approval.

canBetaTest

public boolean canBetaTest()
Returns:
true, if the user is permitted to log in to a beta test server

canContact

public boolean canContact()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

canEnterChatZone

public boolean canEnterChatZone()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

canEnterMenuZone

public boolean canEnterMenuZone()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

canLogIn

public boolean canLogIn(String passGuess)
Determine whether the user can log in with the given password.

Parameters:
passGuess - The user's attempted password
Returns:
true, if the user gave the correct password, and is allowed to log in. False, if any of these is not true (but does not give any information why)

canMakePurchase

public boolean canMakePurchase()

Only adults are allowed to make purchases. Determine whether this user is allowed to make purchases, or if we should ask them to get their parents to buy things for them.

In the future, this might not be just a test to check whether the user is an adult. We might, for example, have kids with gift cards that will be able to make some purchases on their own.

Returns:
true, if this user is allowed to purchase things. False, if they have to get their parents' permission.

canTalk

public boolean canTalk()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

checkPassword

public boolean checkPassword(String passwordGuess)
Parameters:
passwordGuess - the password to be checked
Returns:
true, if the password matches

copyProtoype

public UserRecord copyProtoype(UserRecord prototype)
Description copied from interface: Copyable
WRITEME: Document this method brpocock@star-hope.org

Specified by:
copyProtoype in interface Copyable<UserRecord>
Parameters:
prototype - WRITEME
Returns:
self, for chaining
See Also:
Copyable.copyProtoype(org.starhope.appius.util.DataRecord)

generateSystemName

public String generateSystemName()
Generate a new "anonymous user name" for the user.

Returns:
the name generated

getAge

public int getAge()
Get the current age of the user. This is set up such that the user's age will increment on their birthday.

Returns:
The user's legal age, in years.

getAgeGroup

public AgeBracket getAgeGroup()
Returns:
the ageGroup

getApprovedDate

public Date getApprovedDate()
Returns:
the approvedDate

getAvatarClass

public AvatarClass getAvatarClass()
Returns:
the avatarClass

getBaseColor

public Colour getBaseColor()
Returns:
the baseColor

getBirthDate

public Date getBirthDate()
Returns:
the birthDate

getCacheableID

public int getCacheableID()
Description copied from interface: DataRecord
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.

Specified by:
getCacheableID in interface DataRecord
Returns:
an unique ID number
See Also:
DataRecord.getCacheableID()

getCacheableIdent

public String getCacheableIdent()
                         throws NotFoundException
Description copied from interface: DataRecord
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.

Specified by:
getCacheableIdent in interface DataRecord
Returns:
an unique identifier string
Throws:
NotFoundException - if there's neither a login nor a requested name
See Also:
DataRecord.getCacheableIdent()

getChatBG

public Colour getChatBG()
Returns:
the chatBG

getChatFG

public Colour getChatFG()
Returns:
the chatFG

getCurrency

public BigDecimal getCurrency(Currency ident)
Parameters:
ident - the currency identifier
Returns:
the amount of that currency

getDebugName

public String getDebugName()
Returns a specific string identifying this user in a convenient form for debugging. The form is: “u:LOGIN=#ID” where LOGIN is the user's login name, and ID is their numeric

Returns:
the debugging string identifying this user

getDialect

public String getDialect()
Returns:
the dialect

getDisplayName

public String getDisplayName()
Returns:
the name of the user as it should be displayed
See Also:
AbstractPerson.getDisplayName()

getEmailPlusDate

public Date getEmailPlusDate()
Returns:
the emailPlusDate

getEnrolments

public Collection<UserEnrolment> getEnrolments()
get all enrolments in which this user is enrolled.

Returns:
a set of enrolments.

getExtraColor

public Colour getExtraColor()
Returns:
the extraColor

getForgotPasswordAnswer

@Deprecated
public String getForgotPasswordAnswer()
Deprecated. use getPasswordRecoveryAnswer()

Returns:
the forgotPasswordAnswer

getForgotPasswordQuestion

@Deprecated
public String getForgotPasswordQuestion()
Deprecated. use getPasswordRecoveryQuestion()

Returns:
the forgotPasswordQuestion

getGivenName

public String getGivenName()
Returns:
the givenName

getHouse

public UserHouse getHouse()
Returns:
this user's house

getInv

public Inventory getInv()
Returns:
the inventory

getKickedByUserID

public int getKickedByUserID()
get the user ID who kicked this user offline.

Returns:
the user ID of the moderator who kicked this user offline (1 for the system)

getKickedReasonCode

public String getKickedReasonCode()
get the reason code for which the user was kicked offline; see WRITEME?

Returns:
the reason code

getKickedUntil

public Timestamp getKickedUntil()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getLanguage

public String getLanguage()
Returns:
the language

getLastZoneName

public String getLastZoneName()
Returns:
the lastZoneName

getLogin

public String getLogin()
Returns:
the login

getMail

public String getMail()
Returns:
the mail

getMailConfirmed

public Date getMailConfirmed()
Returns:
the mailConfirmed

getMailConfirmSent

public Date getMailConfirmSent()
Returns:
the mailConfirmSent

getNameApprovedAt

public Timestamp getNameApprovedAt()
Returns:
the nameApprovedAt

getNameApprovedByUserID

public int getNameApprovedByUserID()
Returns:
the nameApprovedByUserID

getNameRequestedAt

public Timestamp getNameRequestedAt()
Returns:
the nameRequestedAt

getParent

private Parent getParent()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

getParentID

public int getParentID()
WRITEME: Document this method brpocock@star-hope.org

Returns:
parent id

getPassword

String getPassword()
Returns:
password

getPasswordRecoveryAnswer

public String getPasswordRecoveryAnswer()
Returns:
answer to the password recovery question

getPasswordRecoveryQuestion

public String getPasswordRecoveryQuestion()
Returns:
password recovery question

getReferer

public String getReferer()
Returns:
the referer

getRegisteredAt

public Timestamp getRegisteredAt()
Returns:
the registeredAt

getRegisteredDate

public Date getRegisteredDate()
Returns:
the date on which this user first registered
See Also:
the time registered

getRegisteredDateString

public String getRegisteredDateString()
Returns:
Returns an user-visible string describing when the user was registered
See Also:
getRegisteredDate()

getRequestedName

public String getRequestedName()
Returns:
the name that the user requested

getResponsibleMail

public String getResponsibleMail()

Get the eMail address of a responsible person: either the player, or the parent.

Currently, kids 13-17 return their own mail.

Returns:
the eMail address

getSerial

public long getSerial()
Internal serial number for tracking user records through the cache

Returns:
the instance serial number

getStaffLevel

public int getStaffLevel()
Returns:
the staffLevel

getSubversionRevision

public String getSubversionRevision()
Description copied from interface: HasSubversionRevision

Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.

As an example,the Subversion revision string for this file is "$Rev: 1968 $"

 
 @Override
 public String getSubversionRevision () {
        return "$Rev: ";
 }
 

Specified by:
getSubversionRevision in interface HasSubversionRevision
Returns:
The Subversion revision level for this class's source code file.
See Also:
HasSubversionRevision.getSubversionRevision()

getSystemNameAdjective

private String getSystemNameAdjective()
Returns:
an adjective usable as part of a system-generated name

getSystemNameNoun

private String getSystemNameNoun()
Returns:
a noun usable as part of a system-generated name

getTravelRate

public double getTravelRate()
Returns:
the travelRate

getUserID

public int getUserID()
Returns:
the userID

getUserNameOrRequest

public String getUserNameOrRequest()
return the user's login name, if they have one; or the name that they have requested, if it hasn't been approved yet. If they have not requested any name at all, returns the string "(No name)" .

Returns:
the user's login name, or their requested name, or a string indicating that they have neither.

getWallet

private Wallet getWallet()
Returns:
the user's wallet

hasStaffLevel

public boolean hasStaffLevel(int staffLevelNeeded)
Returns true if the user has the asserted staff level, or a staff level which includes it. Returns false, otherwise.

Parameters:
staffLevelNeeded - The minimum staff level for which we are testing.
Returns:
True, if the user meets the minimum staff level stated; false, otherwise.

isActive

public boolean isActive()
Returns:
the isActive

isApproved

public boolean isApproved()
WRITEME: Document this method brpocock@star-hope.org

Returns:
WRITEME

isBanned

public boolean isBanned()
Returns:
the isBanned

isBirthday

public boolean isBirthday()
Returns:
true, if today is the user's birthday

isCanceled

public boolean isCanceled()
Returns:
the isCanceled

isEphemeral

public boolean isEphemeral()
Returns:
the isEphemeral

isKicked

public boolean isKicked()
Returns true if the user has been kicked offline (and the time has not yet elapsed). Returns false otherwise. This does not check the status as to whether the user might have been banned.

Returns:
true, if the user is kicked offline.

isNotable

public boolean isNotable()
Returns:
true, if this is a notable NPC/character

isPaidMember

public boolean isPaidMember()
Returns:
true, if the user is a paid member (or staff member)

isParentApprovedName

public boolean isParentApprovedName()
Returns:
the parentApprovedName

kick

public Timestamp kick(AbstractUser kickedBy,
                      String kickedReason,
                      Timestamp allowBack)
               throws PrivilegeRequiredException
Kick the user offline, until a certain date & time.

Parameters:
kickedBy - The user who is kicking this user offline
kickedReason - The reason for which s/he is being kicked
allowBack - The time at which this user is permitted to be online again.
Returns:
the time at which the user is permitted back online. May be less than the time requested, if the user kicking doesn't have sufficient privileges.
Throws:
PrivilegeRequiredException - if the person trying to kick this user off doesn't have moderator privileges

liftBan

public void liftBan(AbstractUser authority)
             throws PrivilegeRequiredException
Parameters:
authority - by whose authority is the ban to be lifted?
Throws:
PrivilegeRequiredException - if that user lacks authority to lift the ban

myUser

AbstractUser myUser()
find the user backed by this user record

Returns:
the user backed by this user record

needsNaming

public boolean needsNaming()
Returns:
true, if the user needs naming before joining the game

needsParent

public boolean needsParent()
Kid accounts (under 13) require parental confirmation. In order to get that, we have to get a parental contact. If this field is false, then the user is either a teenager or adult, or they have a parent on file. It does not mean that they have had their account approved: only that they have given us the parental information (if we needed it). If we ever encounter a user for whom this flag is true, ask them “who's your daddy?”

Returns:
true, if this is a kid account without a known parent (yet)

parentApprovedAccount

public void parentApprovedAccount(boolean whether)
Parameters:
whether - if true, the parents have approved the account; if false, they did not (cancel the account)

parentApprovedName

public void parentApprovedName(boolean whether)
Parameters:
whether - True if the parent has approved the name; false if they disapprove and want a system suggested name.

requestNewUserName

public void requestNewUserName(String userNameRequested)
                        throws AlreadyUsedException,
                               ForbiddenUserException

Post a request to the lifeguards to get approval of a user name

Does not work, is not used

Parameters:
userNameRequested - The user name which the user has requested
Throws:
ForbiddenUserException - if the user name is forbidden (e.g. obscene or previously denied for any reason)
AlreadyUsedException - if someone has already requested or used it

setActive

public void setActive(UserActiveState state)
Sets the active state to the given state

Parameters:
state - the new state (OK, CAN, BAN)

setAgeGroup

@Setter(getter="getAgeGroup")
@OpEd(isAdvanced=true,
      label="Age Group",
      advice="Age group is normally set automatically by setting the age. However, NPC:s must have their age group set to System (\u201cX\u201d).",
      needCap="CAP_NPC")
public AgeBracket setAgeGroup()
set the age bracket of the user record, based upon the specified date of birth.

Returns:
the age bracket of this user

setAgeGroup

public void setAgeGroup(AgeBracket ageGroup1)
Parameters:
ageGroup1 - the ageGroup to set

setAgeGroupToSystem

public void setAgeGroupToSystem()
Declares this to be an inhuman, ergo ageless, user account.


setApproved

public void setApproved()
set the date on which the user's account was approved, to the current time.


setApprovedDate

public void setApprovedDate(Date date)
Parameters:
date - the approvedDate to set

setAvatarClass

public void setAvatarClass(AvatarClass avatarClass1)
Parameters:
avatarClass1 - the avatarClass to set

setBaseColor

public void setBaseColor(Colour newBaseColor)
Parameters:
newBaseColor - the baseColor to set

setBirthDate

public void setBirthDate(Date birthDate1)
Parameters:
birthDate1 - the birthDate to set

setCanBetaTest

public void setCanBetaTest(boolean canBetaTest1)
Parameters:
canBetaTest1 - the canBetaTest to set

setCanContact

public void setCanContact(boolean b)
set whether the user acquiesces to be contacted

Parameters:
b - true, if the user will let us contact him/her

setCanEnterChatZone

public void setCanEnterChatZone(boolean newCanEnterChatZone)
Parameters:
newCanEnterChatZone - the canEnterChatZone to set

setCanEnterMenuZone

public void setCanEnterMenuZone(boolean newCanEnterMenuZone)
Parameters:
newCanEnterMenuZone - the canEnterMenuZone to set

setCanTalk

public void setCanTalk(boolean newCanTalk)
Parameters:
newCanTalk - the canTalk to set

setChatBG

public void setChatBG(Colour newChatBG)
Parameters:
newChatBG - the chatBG to set

setChatFG

public void setChatFG(Colour newChatFG)
Parameters:
newChatFG - the chatFG to set

setCurrency

public void setCurrency(Currency units,
                        BigDecimal bigDecimal)
set the user's quantity of currency of a given type

Parameters:
units - currency units
bigDecimal - the amount to set

setCurrencyIfUnknown

public void setCurrencyIfUnknown(Currency units,
                                 BigDecimal bigDecimal)
set the user's currency of a given type, only if it is not already known

Parameters:
units - currency units
bigDecimal - the amount to set

setEmailPlusDate

public void setEmailPlusDate(Date emailPlusDate1)
Parameters:
emailPlusDate1 - the emailPlusDate to set

setEphemeral

public void setEphemeral(boolean newEphemeral)
Parameters:
newEphemeral - the isEphemeral to set

setExtraColor

public void setExtraColor(Colour newExtraColor)
Parameters:
newExtraColor - the extraColor to set

setGivenName

public void setGivenName(String newName)
Parameters:
newName - the givenName to set

setKickedByUserID

public void setKickedByUserID(int kickerID)
Parameters:
kickerID - the kickedByUserID to set

setKickedReasonCode

public void setKickedReasonCode(String reason)
Parameters:
reason - the kickedReasonCode to set

setKickedUntil

public void setKickedUntil(Timestamp kickedUntilTime)
Parameters:
kickedUntilTime - the kickedUntil to set

setLanguage

public void setLanguage(String newLanguage,
                        String newDialect)
Parameters:
newLanguage - the new language
newDialect - the new dialect

setLastZoneName

public void setLastZoneName(String lastZoneName1)
Parameters:
lastZoneName1 - the lastZoneName to set

setLogin

public void setLogin(String newLogin)
set the user's login name

Parameters:
newLogin - the user's new login name

setMail

public void setMail(String newMail)
Parameters:
newMail - the mail to set

setMailConfirmed

public void setMailConfirmed(Date mailConfirmed1)
Sets the user capabilities to allow talking, and permits the user entry into both chat zones and menu-chat-only zones.

Parameters:
mailConfirmed1 - the date and time at which the user's mail was confirmed.

setMailConfirmSent

public void setMailConfirmSent(Date dateConfirmationSent)
Parameters:
dateConfirmationSent - the mailConfirmSent to set

setMailConfirmSent

public void setMailConfirmSent(long when)
Parameters:
when - when the confirmation eMail was sent out

setNameApprovedByUserID

public void setNameApprovedByUserID(int userWhoApproved)
Parameters:
userWhoApproved - the nameApprovedByUserID to set

setNeedsNaming

public void setNeedsNaming(boolean needsNaming1)
Parameters:
needsNaming1 - the needsNaming to set

setNotable

public void setNotable(boolean really)
Parameters:
really - true, if this is a notable NPC/character

setParentApprovedName

public void setParentApprovedName(boolean parentApprovedName1)
Parameters:
parentApprovedName1 - the parentApprovedName to set

setParentID

void setParentID(int id)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
id - parent id

setPassword

public void setPassword(String newPass)
WRITEME WRITEME: Document this method brpocock@star-hope.org

Parameters:
newPass - WRITEME

setPasswordRecovery

public void setPasswordRecovery(String question,
                                String answer)
Set the question & answer pair to be used to trigger forgotten password recovery

Parameters:
question - the question
answer - the answer

setReferer

public void setReferer(String theReferer)

Set the referrer from whom we were sent this new user. This value can only be set once, and is permanent for that user. The valid referrer values are stored in a table. (WRITEME twheys@gmail.com what table?)

Yes, referer is misspelled in homage to HTTP

Parameters:
theReferer - a four-character identifier

setRegisteredAt

public void setRegisteredAt(Timestamp newRegisteredAt)
Parameters:
newRegisteredAt - the registeredAt to set

setRequestedName

public void setRequestedName(String requestedName1)
Parameters:
requestedName1 - the requestedName to set

setStaffLevel

public void setStaffLevel(int staffLevel1)
Parameters:
staffLevel1 - the staffLevel to set

setTravelRate

public void setTravelRate(double travelRate1)
Parameters:
travelRate1 - the travelRate to set

setTravelRatePrivately

public void setTravelRatePrivately(double rate)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
rate - RATE

setUserID

public void setUserID(int userID1)
Parameters:
userID1 - the userID to set

toString

public String toString()
Overrides:
toString in class SimpleDataRecord<UserRecord>
See Also:
Object.toString()