org.starhope.appius.user
Class User

java.lang.Object
  extended by org.starhope.appius.sql.SQLPeerDatum
      extended by org.starhope.appius.user.Person
          extended by org.starhope.appius.user.User
All Implemented Interfaces:
Serializable, Comparable<User>, RoomListener, HasVariables, AbstractUser, ViaAppia<RemoteUser>

public abstract class User
extends Person
implements AbstractUser, ViaAppia<RemoteUser>, Comparable<User>, HasVariables

This class encapsulates all of the user/player information for the game.

Author:
brpocock, theys
See Also:
Serialized Form

Field Summary
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 baseColor
          The base colour of the avatar
private  Date birthDate
          The user's date of birth.
private  UserList buddyList
          The list of buddies for this user.
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  AbstractRoom currentRoom
          The current room in which the user is active.
private  Date emailPlusDate
          For kids, this is the date on which eMail Plus secondary eMail is sent out.
private  Colour extraColor
          The extra colour of the avatar.
private  String facing
          The direction in which the user is facing.
private  boolean haveInventory
          Has the user's inventory been loaded?
private  UserList ignoreList
          The list of users whom this user is ignoring.
private  HashSet<org.starhope.appius.game.inventory.InventoryItem> inventory
          All types of inventory in a single set.
private  boolean isActive
          If true, the account is active (not canceled nor banned)
private  boolean isBanned
          If true, the account is banned (not active nor canceled)
private  boolean isCanceled
          If true, the account is canceled (not active nor banned)
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  Timestamp lastActive
          the time at which the user last was logged on, or the current time (plus 5 seconds) if they're on now.
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 static ConcurrentHashMap<String,User> liveCache
          A simple cache of live users
private  String login
          The user's current, active login name.
static int MAX_LOGIN_LENGTH
          Maximum length of a login/username (in characters)
static int MAX_PW_LENGTH
          Maximum length of a password (in characters)
static int MIN_LOGIN_LENGTH
          Minimum length of a login/username (in characters)
static int MIN_PW_LENGTH
          Minimum length of a password (in characters)
private  int mySerial
          unique instance ID
private  Timestamp nameApprovedAt
          The timestamp of Lifeguard approval of the user's name (or null, if it hasn't been approved yet)
private  long nameApprovedByUserID
          The user ID of the moderator who approved this user's name
protected  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  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"
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  HashSet<Integer> rooms
          The set of rooms in this user's house (and yard).
private static int serial
           
private static long serialVersionUID
          Serial Version Unique Identifier for Java Serialization.
private  AppiusClaudiusCaecus serverThread
          The server thread through which this user is connected.
static int STAFF_LEVEL_ACCOUNT_SERVICE
          Staff level for users able to view account (subscription) data
static int STAFF_LEVEL_DESIGNER
          Staff level for users able to edit the game world
static int STAFF_LEVEL_DEVELOPER
          Staff level for software developers
static int STAFF_LEVEL_MODERATOR
          Staff level for moderators (including life guards and tour guides)
static int STAFF_LEVEL_PUBLIC
          Staff level for public users (free or paid users)
static int STAFF_LEVEL_STAFF_MEMBER
          Staff level for all members of the staff (Sidereal employees)
protected  int staffLevel
          The level of staff authority possessed by this user.
private  double targetX
          The destination ordinate toward which the user is currently moving.
private  double targetY
          The destination mantissa toward which the user is currently moving.
private  double travelRate
          The rate of movement (in pixels per millisecond) of this user.
private  long travelStartTime
          The time at which the user started moving on their current movement vector.
private static com.whirlycott.cache.Cache userCache
          The WhirleyCache of users
protected  int userID
          The user's numeric ID, for database purposes.
private  ConcurrentHashMap<String,String> userVariables
          Arbitrary user variables which can be set or retrieved by the front-end
private  double x
          The user's origination ordinate
private  double y
          The user's origination abcessa
 
Fields inherited from class org.starhope.appius.user.Person
canContact, dialect, forgotPasswordAnswer, forgotPasswordQuestion, givenName, language, mail, mailConfirmed, mailConfirmSent, password
 
Constructor Summary
protected User(Date birthDate1, String avatarTitle, String userNameRequest)
          Create a new user account
  User(int id)
          Instantiate a user object from an existing user account ID
protected User(ResultSet rs)
          Instantiate a User object based upon the contents of a ResultSet.
  User(String newUserLogin)
          Instantiate a user object from an existing user account ID
 
Method Summary
protected static void __debugTracePeanuts(AbstractUser me)
           theys Jan 7, 2010
 void acceptAdminMessage(AbstractRoom room, String string)
          Deprecated. use acceptAdminMessage(String, String, String) instead
 void acceptAdminMessage(Integer room, String string)
          Deprecated. use acceptAdminMessage(String, String, String) instead
 void acceptAdminMessage(String message, String title, String label)
          Send an administrative or moderator message to the client
 void acceptErrorReply(String command, String error, org.json.JSONObject result, AbstractRoom room)
           
 void acceptGameAction(AbstractUser sender, org.json.JSONObject action)
          This is an overriding method.
 void acceptGameStateChange(GameEvent gameCode, GameStateFlag gameState)
          This is an overriding method.
 void acceptMessage(String title, String caption, String message)
          Accept an administrative/moderator message with the full range of options
 void acceptObjectJoinRoom(AbstractRoom room, AbstractUser object)
          Accept notification of a user or object joining the room.
 void acceptObjectJoinRoom(AbstractRoom room, RoomListener object)
          Notification that someone has entered the room.
 void acceptObjectPartRoom(AbstractRoom room, RoomListener object)
          Accept notification of a user or object departing the room.
 void acceptOutOfBandMessage(AbstractUser sender, AbstractRoom room, org.json.JSONObject body)
          Accept an out-of-band message from a room.
 void acceptPrivateMessage(AbstractUser from, String message)
          Accept an incoming private message (“whisper”) from another user.
 void acceptPublicMessage(AbstractUser sender, AbstractRoom room, String message)
          This is an overriding method.
 void acceptPublicMessage(AbstractUser from, String message)
          This is an overriding method.
 void acceptSuccessReply(AbstractZone zone, AbstractRoom room, String command, org.json.JSONObject jsonData)
          Deprecated. for shorter acceptSuccessReply(String, JSONObject, AbstractRoom)
 void acceptSuccessReply(String command, org.json.JSONObject jsonData, AbstractRoom room)
           
 void addBuddy(AbstractUser newBuddy)
          Adds a user to this user's buddy list.
 void addDefaultFreeItem(int id)
          Identical to @link addDefaultFreeItem(int, boolean) with “false” for the second parameter
 void addDefaultFreeItem(int id, boolean forceActive)
          Add an item which every user gets for free to the user's inventory, if it does not already exist.
protected  void addFreeClothing(org.starhope.appius.game.inventory.ClothingItem clothingItem)
           
 void addGiftSubscription(int months, int days)
           Create a gift subscription for a user, to last the given number of months plus the given number of days.
 void addItem(int itemID)
          Add an item to the user's inventory.
 void addItem(org.starhope.appius.game.inventory.InventoryItem item)
          Add an item to the user's inventory.
 void addRoom(int roomNumber)
           
protected  void affirmFreeMember()
          Affirm that this is a free (non-premium) member and remove clothing and patterns.
 void affirmPaidMember()
          Ensure that this user has the benefits of being a paid member, effective immediately
 void approveName(AbstractUser abstractUser)
          Approve the user's requested name, and make it active
 void assertStaffLevel(int staffLevelNeeded)
          Assert that this user must have the given staff level (or greater).
static void assertUserNameAvailable(String userNameRequested)
           Make the assertion that the user name supplied is available to be requested or assigned to this user.
 void attend(AbstractUser otherGuy)
          Attend to an user who may previously have been ignored
 void ban(AbstractUser bannedBy, String bannedReason)
          Ban a user, preventing any future access to the server.
 void blog(String message)
          send a message with various debugging information to the journals
 boolean canApproveSelf()
          If the user is a teen (13+) or adult, they are allowed to approve their own account.
 void cancelEvent(int eventID)
          TODO: document this method (brpocock, Jan 15, 2010)
 boolean canLogIn(String passGuess)
          Determine whether the user can log in with the given password.
 boolean canMakePurchase()
           Only adults are allowed to make purchases.
static boolean canSeeSmartFoxServer()
          Deprecated. 
 boolean canTalk()
           
 void changed()
          This is an overriding method.
 AbstractRoom changeRoom(AbstractRoom room)
           
 boolean checkPassword(String passwordGuess)
          Returns true if the password is correct.
 int compareTo(User o)
          This is an overriding method.
static void configUpdated()
          This is the callback that is called whenever the AppiusConfig reloads the configuration or has a runtime configuration value changed.
static User create(Date date, String string, String nick)
          Create a new user account
static void dangerous__removeTestUsers()
          Delete test users: test???? accounts with email of testing@tootsville.com will be DESTROYED from the database.
 boolean deleteMail(int messageID)
          Mark a message as being deleted in the messages database.
 void deleteVariable(String key)
          This is an overriding method.
 void doff(org.starhope.appius.game.inventory.ClothingItem item)
          Doff a wearable item
 void doffClothes()
          Get naked
 void doffPatterns()
          Get bare
 void doffPivitz()
          Remove Pivitz
private static void dumpLiveCache()
          Print out a nasty, verbose debugging dump of the users live cache to the STDOUT.
 void endEventPurchaseRaw(int eventID, int itemID)
          WRITEME: document this method (brpocock, Aug 31, 2009)
protected abstract  void endEventPurchaseRaw(int eventID, ItemCreationTemplate itemCreationTemplate)
          WRITEME: document this method (brpocock, Dec 30, 2009)
 org.json.JSONObject endMultiplayerEvent(Integer eventID, String gameMoniker, String gameCode, BigDecimal playerScoreDecimal, LinkedHashMap<Integer,Integer> sortedScores)
          This is an overriding method.
abstract  org.json.JSONObject endMultiplayerEvent(int eventID, String moniker, String gameCode, BigDecimal score, LinkedHashMap<Integer,Integer> scores)
          end a multiplayer event … WRITEME details?
 boolean equals(Object o)
          This is an overriding method.
 boolean equals(User o)
          Determine if two user objects are identical.
 void equip(org.starhope.appius.game.inventory.InventoryItem item)
          Equip an item
protected  void fetch_avatarInfo(ResultSet resultSet)
          Fetch the user's avatar information from the database
protected  void fetch_chatColours(ResultSet resultSet)
          Fetch the chat colours for this user from the database
protected  void fetch_dobInfo(ResultSet resultSet)
          Fetch the user's date of birth and related information from the database record provided
private  void fetch_inventory()
          Sub-fetch routine called by set(ResultSet) to handle inventory load.
protected  void fetch_language(ResultSet resultSet)
          Fetch the user's language and dialect information from the database record
protected  void fetch_laston()
          Fetch the user's last activity information from the database record
protected  void fetch_mailInfo(ResultSet resultSet)
          Fetch the user's eMail info from the database record
protected  void fetch_more(ResultSet resultSet)
          Fetch additional results fields from a database record — mostly intended to be overridden by derived classes
protected  void fetch_parentInfo(ResultSet resultSet)
          Fetch information about the user's parent (if any).
protected  void fetch_passwordResetInfo(ResultSet resultSet)
          Fetch the password reset question and answer from the provided database record.
protected  void fetch_permissionsInfo(ResultSet resultSet)
          Fetch the permissions-related portion of a user's record out of the SQL ResultSet.
protected  void fetch_userBasicInfo(ResultSet resultSet)
          Fetch the user's basic information: user ID, user name, and password — from the provided database record
protected  void flush_breakOut_chatColours(PreparedStatement update, int bgColumnNumber, int fgColumnNumber)
          WRITEME: document this method (brpocock, Jan 8, 2010)
protected  void flush_breakOut_dob(PreparedStatement update)
          Breakout of the flush operation to update the user's date of birth and age group
protected  void flush_breakOut_language(PreparedStatement update)
          WRITEME: document this method (brpocock, Sep 23, 2009)
protected  void flush_breakOut_loginPass(PreparedStatement update)
          WRITEME: document this method (brpocock, Sep 23, 2009)
protected  void flush_breakOut_mail(PreparedStatement update)
          Flush the user's eMail information to the database
protected  void flush_breakOut_nameRequest(PreparedStatement update)
          Prepare the name-request details for flush()
protected  void flush_breakOut_parent(PreparedStatement update)
          Prepare the user's parent's details for flush()
protected  void flush_breakOut_permissions(PreparedStatement update)
          set permissions for a database flush
protected  void flush_breakOut_referer(PreparedStatement update, int column)
          Prepare the “referer” field for flush()
abstract  void flush()
           
 boolean forgotPassword(String forgottenPasswordQ, String forgottenPasswordA)
          Send the user their forgotten password if they know the answer to their secret question.
 void generateSystemName()
          Generate a new "anonymous user name" for the user.
static AbstractUser get(org.json.JSONObject object)
          Pick up a user from a JSON object containing either the ID or login (user name) string
 org.json.JSONObject getActiveClothing()
           
 Collection<org.starhope.appius.game.inventory.HomeDecorItem> getActiveDecorations(int roomNumber)
          get the decorations active (placed) in a room of this user's house
 org.starhope.appius.game.inventory.InventoryItem getActiveItemByType(InventoryItemType t)
          Returns the active item for an item type.
 org.starhope.appius.game.inventory.InventoryItem getActiveItemByType(String t)
          Returns the active item for an item type.
static org.starhope.appius.game.inventory.InventoryItem getActiveItemByTypeAndUserID(int typeID, int userID)
          WRITEME: Document this field.
static org.starhope.appius.game.inventory.InventoryItem getActiveItemByTypeAndUserID(InventoryItemType type, int userID)
          WRITEME: Document this field.
 int getAge()
          Get the current age of the user.
 AgeBracket getAgeGroup()
           
abstract  String getApprovalCookie()
          Get a cookie object for sending mail.
 Date getApprovedDate()
           
 String getApprovedDateString()
           
 AvatarClass getAvatarClass()
           
 String getAvatarLabel()
          This is an overriding method.
 Colour getBaseColor()
           
 Date getBirthDate()
           
 UserList getBuddyList()
          Get the user's buddy list (a UserList)
 Collection<String> getBuddyListNames()
          Get the names of everyone on the user's buddy list.
 String[] getBuddyListNamesAsArray()
          Get the names of everyone on the user's buddy list.
static AbstractUser getByID(int id)
          Instantiate a user object from an existing user account ID
static AbstractUser getByLogin(String login)
           
static AbstractUser[] getByMail(String mail)
          Returns an array of all users associated with a given eMail address.
static User getByRequestedName(String userNameRequested)
          Get the user who has requested a certain name, if any.
protected  String getCacheUniqueID()
          This is an overriding method.
 Colour getChatBG()
           
 Colour getChatFG()
           
 String getConfirmationTemplate()
          This is an overriding method.
 String getConnectedFrom()
          Get the IP address or hostname from which the user is connected (if we can tell).
 String getDialect()
           
 String getDisplayName()
          This method's only use is for more closely aligning User and Parent classes.
 Date getEmailPlusDate()
           
 String getEmailPlusDateString()
           
 Colour getExtraColor()
           
 String getFacing()
          Get the string identifying the direction which this object is facing.
 org.starhope.appius.game.inventory.HomeDecorItem getFurnitureBySlot(int slotNumber)
           
private  org.starhope.appius.game.inventory.GameEquipItem getGameEquipItem()
          If the user has a game item equipped (e.g.
 boolean getGameFlag(String name)
          Return the status of the indicated game flag.
 String getGivenName()
           
 HashMap<Timestamp,HashMap<String,String>> getHistory(Date after, int limit)
          Returns the historical contents of this user's record.
static int getIDForLiveUserName(String name)
          Find the user name for a user who is currently signed on.
static int getIDForLogin(String name)
          Fetch the user ID number for a user name
static int getIDForUserName(String name)
          Deprecated. getIDForLogin(String)
 UserList getIgnoreList()
           
protected  HashSet<org.starhope.appius.game.inventory.InventoryItem> getInventory()
           
 String getIpAddress()
          Deprecated. Smart Fox Server misspelling of getIPAddress()
 String getIPAddress()
           
 Collection<org.starhope.appius.game.inventory.InventoryItem> getItemsByType(String typeString)
          Get all items that identify as the type string.
 Collection<org.starhope.appius.game.inventory.InventoryItem> getItemsByType(String[] types)
          WRITEME: document this method (brpocock, Aug 28, 2009)
 org.starhope.appius.game.inventory.InventoryItem[] getItemsByTypeAsArray(String typeString)
          Get all items that identify as the type string.
 int getKickedByUserID()
           
 String getKickedMessage()
           
 String getKickedReasonCode()
           
 Timestamp getKickedUntil()
          String?? TODO? FIXME?
 Timestamp getLastActive()
           
 String getLastZone()
           
 RoomAndZone getLocation()
          Get the user's current location (room and zone) if the user is online; or, “null” if the user is not online.
 String getLogin()
           
 int getMySerial()
           
 String getName()
           
 Timestamp getNameApprovedAt()
           
 long getNameApprovedByUserID()
           
 Timestamp getNameRequestedAt()
           
 Parent getParent()
           
 boolean getParentApprovedName()
           
 int getParentID()
           
 org.json.JSONObject getPassport_JSON()
           
 String getPotentialUserName()
          This is an overriding method.
 org.json.JSONObject getPublicInfo()
          TODO: document this method (brpocock, Oct 31, 2009) avatar, userName, clothes, colors
 String getReferer()
          Get the referral/affiliate code from this user's initial signup
 Timestamp getRegisteredAt()
           
 Date getRegisteredDate()
           
 String getRegisteredDateString()
           
 String getRequestedName()
           
 String getResponsibleMail()
           Get the eMail address of a responsible person: either the player, or the parent.
static String getRev()
           
 AbstractRoom getRoom()
          TODO: document this method (brpocock, Oct 31, 2009)
 int getRoomNumber()
          TODO: document this method (brpocock, Jan 11, 2010)
 long getSerial()
          Get the unique instance serial number for this instance of this user.
 AppiusClaudiusCaecus getServerThread()
          Get the Appius Claudius Caecus server thread (if any) associated with this User (if they are logged-in).
 int getStaffLevel()
          TODO: document this method (brpocock, Jan 11, 2010)
private  String getSystemNameAdjective()
           
private  String getSystemNameNoun()
           
static AbstractUser getSystemUser()
          Get the System user object (the user which represents the system program itself).
 double getTargetX()
          TODO: document this method (brpocock, Oct 31, 2009)
 double getTargetY()
          TODO: document this method (brpocock, Oct 31, 2009)
 double getTravelRate()
          This is an overriding method.
 long getTravelStart()
          This is an overriding method.
 Collection<UserEnrolment> getUserEnrolments()
           
 UserEnrolment[] getUserEnrolmentsAsArray()
           
 int getUserID()
          TODO: document this method (brpocock, Oct 31, 2009)
 String getUserName()
           
static String getUserNameForID(int id)
           
 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.
static Collection<AbstractUser> getUsersAwaitingNameApproval()
          Get up to 20 users who are awaiting approval of their names.
 HashMap<String,String> getUserVariables()
          Get all user variables in a hash map
 String getVariable(String string)
          TODO: document this method (brpocock, Oct 31, 2009)
 double getX()
          TODO: document this method (brpocock, Oct 31, 2009)
 double getY()
          TODO: document this method (brpocock, Oct 31, 2009)
static String[] getZ$Z()
          Z$Z
 AbstractZone getZone()
          Get the user's current Zone, if the user is online.
 int hashCode()
          Get a (hopefully unique) hash code for this user.
 boolean hasItem(int id)
          Determine whether this user has this item
 boolean hasItem(org.starhope.appius.game.inventory.InventoryItem item)
          determine whether the user has an item
 boolean hasStaffLevel(int staffLevelNeeded)
          Returns true if the user has the asserted staff level, or a staff level which includes it.
 boolean hasVariable(String string)
          This is an overriding method.
 void ignore(AbstractUser otherUser)
          Calling this method indicates that this user wants to ignore the other specified user.
protected abstract  void insertIntoDatabase(Date birthDate1)
          WRITEME: document this method (brpocock, Jan 4, 2010)
private static User instantiateUser(ResultSet rs)
          Instantiate a User (using the selected subclass) from the result set garnered from a SELECT *
 void invalidateCache()
          Invalidate the live cache records of this user after s/he has signed off.
 boolean isActive()
           
 boolean isApproved()
          See approvedDate for discussion
 boolean isBanned()
           
 boolean isBirthday()
           
 boolean isCanceled()
           
 boolean isCanContact()
          TODO: document this method (brpocock, Oct 13, 2009)
 boolean isCanEnterChatZone()
           
 boolean isCanEnterMenuZone()
           
 boolean isCanTalk()
           
static void isItGood()
          Perform basic self-tests upon the User database to identify whether things are good enough to proceed with booting.
 boolean isKicked()
          Returns true if the user has been kicked offline (and the time has not yet elapsed).
static boolean isNameAvailable(String name)
          Determine whether the given name is potentially available for use.
static boolean isNameForbidden(String userNameRequested)
          Determine whether a name is forbidden
static boolean isNameValid(String userName)
          Determines whether the name provided contains allowed characters for an user name.
 boolean isNeedsNaming()
          Returns whether this account has a system-provided (not user-provided) name, or no name at all, and we need to prompt the user (or parent) to name it.
 boolean isNeedsParentAttention()
           
 boolean isNPC()
          Determine whether this user is a player-character, or non-player-character.
 boolean isOnline()
          TODO: document this method (brpocock, Oct 31, 2009)
 boolean isPaidMember()
           
 void kick(AbstractUser kickedBy, String kickedReason, long kickedMinutes)
          Kick a user offline for a number of minutes.
 void kick(AbstractUser kickedBy, String kickedReason, Timestamp allowBack)
          Kick the user offline, until a certain date & time.
 void liftBan(AbstractUser authority)
          Lift the ban upon this user.
abstract  void local_create()
          Hook for special stuff to be done right after a new user account is created
protected  void local_publicInfo(org.json.JSONObject userInfo)
          Append information in the subclass to the already-prepared JSON data for the getPublicInfo call
 void loggedIn(String zoneName, AppiusClaudiusCaecus newServerThread)
           
 void loggedIn(String zoneName, SocketChannel channel)
          Deprecated. 
 String login(String chapSeed, String passwordGuess)
          Validate the user's login attempt, returning a failure message if it could not happen (e.g.
 boolean nameNeedsApproval()
          Returns true if this user has requested a name but it hasn't yet been approved by a Lifeguard
 boolean nameNeedsParentalApproval()
           
 boolean needsNaming()
          Returns whether this account has a system-provided (not user-provided) name, or no name at all, and we need to prompt the user (or parent) to name it.
 boolean needsParent()
          Kid accounts (under 13) require parental confirmation.
 void notifyFurnitureInventory(AbstractRoom room)
           
 void parentApprovedAccount(boolean whether)
          Call this method when the parent determines whether to approve or disapprove this account.
 void parentApprovedName(boolean whether)
           
protected  void populateByID(int id)
          Private method used to look up User in the database and fill in the attributes
protected  void populateByLogin(String loadLogin)
          Fetch a user record out of the database based upon its login name
 void postLoginGlobal()
          WRITEME: document this method (brpocock, Jan 8, 2010)
 void readExternal(ObjectInput in)
          XXX Java serialization stuff
protected  void remindPassword()
          This is an overriding method.
 void removeBuddy(AbstractUser otherGuy)
          Don't want for him to be my buddy any more
 void rename(String newName)
           Rename the user account, updating all necessary related records.
 void reportedToModeratorBy(AbstractUser u)
          WRITEME: document this method (brpocock, Aug 31, 2009)
 void requestNewUserName(String userNameRequested)
           Post a request to the lifeguards to get approval of a user name
 void requestParentApproval()
          request parent approval
 void sendConfirmationForPremium()
          Send a confirmation eMail for a premium user.
 void sendEarnings(AbstractRoom room, String string)
           
 void sendGameAction(User from, org.json.JSONObject data)
          Deprecated. 
 void sendMigrate(AbstractZone refugeeZone)
          Send a notification to the user that s/he should reconnect to a different zone
 void sendOops()
          WRITEME
 void sendPrivateMessage(AbstractUser from, String message)
          Deprecated. 
 void sendPublicMessage(User from, String speech)
          Deprecated. use acceptPublicMessage(AbstractUser, String)
 void sendResponse(org.json.JSONObject result)
           
 void sendResponse(org.json.JSONObject result, int room)
          Deprecated. use sendResponse(JSONObject)
private  void sendSuccessReply(String source, org.json.JSONObject reply, AbstractUser sender, int room)
          Send a “success” reply to the client if one is connected
 void sendUserLists()
          Sends the user an asynchronous notification of their user lists' status.
 void sendWardrobe()
           
protected  void set(ResultSet resultSet)
           
 void setActive(boolean isActive1)
           
 AgeBracket setAgeGroup()
          Sets the age group based upon the user's date of birth.
 void setAgeGroupToSystem()
          Declares this to be an inhuman, ergo ageless, user account.
 void setApprovedDate(Date date)
           
 void setAvatarClass(AvatarClass avatarClass1)
           
 void setBaseColor(Colour newBaseColor)
           
 void setBirthDate(Date birthDate1)
           
 void setCanceled(boolean isCanceled1)
           
 void setCanContact(boolean canContact1)
           
 void setCanEnterChatZone(boolean canEnterChatZone1)
           
 void setCanEnterMenuZone(boolean canEnterMenuZone1)
           
 void setCanTalk(boolean canTalk1)
           
 void setChatBG(Colour newChatBG)
           
 void setChatFG(Colour newChatFG)
           
 void setEmailPlusDate(Date emailPlusDate1)
           
 void setExtraColor(Colour extraColor1)
           
 void setFacing(String newFacing)
           
 void setGivenName(String givenName1)
           
 void setLastActive()
          WRITEME
 void setLogin(String ipAddress, String zone)
          Notify the multiverse that the user is logging in Set up the User records, indicating that the user has (in fact) logged in to the game.
 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 setNeedsNaming(boolean needsNaming1)
           
 void setParent(Parent parent)
          Set this to be a child account with the specified parent.
 void setParentByParent(Parent parent)
          Set this to be a child account with the specified parent.
 void setReferer(String theReferer)
          WRITEME: document this method (brpocock, Sep 22, 2009)
 void setRegisteredAt(Timestamp newRegisteredAt)
           
 int setRoom(AbstractRoom room)
          Set the user's current room to the given room.
 void setServerThread(AppiusClaudiusCaecus newThread)
          Set the server thread controlling this user.
 void setStaffLevel(int newStaffLevel)
           
 void setStartT(long when)
          This is an overriding method.
 void setStructure(org.starhope.appius.game.inventory.HomeDecorItem item)
          Activate one structural element in lieu of any others that occupy the same slot.
protected  void setSubclassValues(ResultSet resultSet)
          Set the values specific to a subclass of User
 void setTargetX(double newTargetX)
           
 void setTargetY(double newTargetY)
           
 void setTravelRate(double rate)
          This is an overriding method.
 void setUserName(String newLogin)
           
 void setUserNameFromUser(String userRequestedLogin)
           Set a user name, requested by the user.
 void setVariable(Map.Entry<String,String> var)
          This is an overriding method.
 void setVariable(String varName, String varValue)
          WRITEME: document this method (brpocock, Oct 19, 2009)
 void setVariables(Map<String,String> map)
          This is an overriding method.
 void setX(double newX)
          TODO: document this method (brpocock, Nov 24, 2009)
 void setY(double newY)
          TODO: document this method (brpocock, Nov 24, 2009)
 void speak(AbstractRoom room, String string)
           
abstract  void startEnrolment(UserEnrolment userEnrolment)
           
 org.json.JSONObject toJSONRef()
          This is analogous to toSFSXML() for the pure JSON “to infinity and beyond” interface
 String toSFSXML()
          TODO: document this method (brpocock, Oct 31, 2009)
 String toString()
           
 void updateCache()
          Update the Whirley cache to know about this object.
 void wear(org.starhope.appius.game.inventory.ClothingItem item)
           
 void wear(org.starhope.appius.game.inventory.ClothingItem item, Colour colour)
          Put on a wearable item, to include Pivitz as well as clothing and so forth.
 void wear(org.starhope.appius.game.inventory.ClothingItem item, int color)
          WRITEME: document this method (brpocock, Jan 12, 2010)
 void writeExternal(ObjectOutput out)
          This is an overriding method.
 
Methods inherited from class org.starhope.appius.user.Person
generateNewPassword, getCouponCode, getForgotPasswordAnswer, getForgotPasswordQuestion, getLanguage, getMail, getMailConfirmed, getPassword, getResponsiblePerson, sendConfirmationMail, sendStaffPasswordReset, sentConfirmationMail, setCouponCode, setForgotPasswordAnswer, setForgotPasswordQuestion, setPassword, setPasswordAndPasswordRecovery, setPasswordRecovery, setRandomPassword
 
Methods inherited from class org.starhope.appius.sql.SQLPeerDatum
findInCache, get, saveInCache, set, toJSON
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.starhope.appius.user.AbstractUser
doTransport, endEvent, getLanguage, getMail, kick, startEvent, toJSON
 

Field Detail

liveCache

private static final ConcurrentHashMap<String,User> liveCache
A simple cache of live users


MAX_LOGIN_LENGTH

public static final int MAX_LOGIN_LENGTH
Maximum length of a login/username (in characters)

See Also:
Constant Field Values

MAX_PW_LENGTH

public static final int MAX_PW_LENGTH
Maximum length of a password (in characters)

See Also:
Constant Field Values

MIN_LOGIN_LENGTH

public static final int MIN_LOGIN_LENGTH
Minimum length of a login/username (in characters)

See Also:
Constant Field Values

MIN_PW_LENGTH

public static final int MIN_PW_LENGTH
Minimum length of a password (in characters)

See Also:
Constant Field Values

serial

private static int serial

serialVersionUID

private static final long serialVersionUID
Serial Version Unique Identifier for Java Serialization. serialVersionUID (long)

See Also:
Constant Field Values

STAFF_LEVEL_ACCOUNT_SERVICE

public static final int STAFF_LEVEL_ACCOUNT_SERVICE
Staff level for users able to view account (subscription) data

See Also:
Constant Field Values

STAFF_LEVEL_DESIGNER

public static final int STAFF_LEVEL_DESIGNER
Staff level for users able to edit the game world

See Also:
Constant Field Values

STAFF_LEVEL_DEVELOPER

public static final int STAFF_LEVEL_DEVELOPER
Staff level for software developers

See Also:
Constant Field Values

STAFF_LEVEL_MODERATOR

public static final int STAFF_LEVEL_MODERATOR
Staff level for moderators (including life guards and tour guides)

See Also:
Constant Field Values

STAFF_LEVEL_PUBLIC

public static final int STAFF_LEVEL_PUBLIC
Staff level for public users (free or paid users)

See Also:
Constant Field Values

STAFF_LEVEL_STAFF_MEMBER

public static final int STAFF_LEVEL_STAFF_MEMBER
Staff level for all members of the staff (Sidereal employees)

See Also:
Constant Field Values

userCache

private static com.whirlycott.cache.Cache userCache
The WhirleyCache of users


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


baseColor

private Colour baseColor
The base colour of the avatar


birthDate

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


buddyList

private UserList buddyList
The list of buddies for this user. Instantiated on the fly by the getter methods, if needed, to save on overhead.


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


currentRoom

private transient AbstractRoom currentRoom
The current room in which the user is active. This can be null.


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.


extraColor

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


facing

private String facing
The direction in which the user is facing. Must be one of: N S E W NE NW SW SE


haveInventory

private boolean haveInventory
Has the user's inventory been loaded?


ignoreList

private UserList ignoreList
The list of users whom this user is ignoring.


inventory

private final HashSet<org.starhope.appius.game.inventory.InventoryItem> inventory
All types of inventory in a single set.


isActive

private boolean isActive
If true, the account is active (not canceled nor banned)


isBanned

private boolean isBanned
If true, the account is banned (not active nor canceled)


isCanceled

private boolean isCanceled
If true, the account is canceled (not active nor banned)


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.


lastActive

private Timestamp lastActive
the time at which the user last was logged on, or the current time (plus 5 seconds) if they're on now.


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.


mySerial

private final transient int mySerial
unique instance ID


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 long nameApprovedByUserID
The user ID of the moderator who approved this user's name


nameRequestedAt

protected 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.


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"


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.


rooms

private final HashSet<Integer> rooms
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).


serverThread

private transient AppiusClaudiusCaecus serverThread
The server thread through which this user is connected.


staffLevel

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


targetX

private double targetX
The destination ordinate toward which the user is currently moving. (May be identical to x)


targetY

private double targetY
The destination mantissa toward which the user is currently moving. (May be identical to y)


travelRate

private double travelRate
The rate of movement (in pixels per millisecond) of this user.


travelStartTime

private long travelStartTime
The time at which the user started moving on their current movement vector. Measured in milliseconds since epoch.


userID

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


userVariables

private final ConcurrentHashMap<String,String> userVariables
Arbitrary user variables which can be set or retrieved by the front-end


x

private double x
The user's origination ordinate


y

private double y
The user's origination abcessa

Constructor Detail

User

protected User(Date birthDate1,
               String avatarTitle,
               String userNameRequest)
        throws AlreadyUsedException,
               ForbiddenUserException,
               NumberFormatException
Create a new user account

Parameters:
birthDate1 - The player's date of birth
avatarTitle - The name of the avatar (class) which the player wants to use. This must be one of the fixed string names of the Basic 8 Toots™
userNameRequest - The user name requested
Throws:
ForbiddenUserException - If the user is administratively prohibited from registering, e.g. due to a bad user name
AlreadyUsedException - If the user name is not available
NumberFormatException - If the date of birth is irrational

User

public User(int id)
     throws NotFoundException
Instantiate a user object from an existing user account ID

Parameters:
id - user ID value
Throws:
NotFoundException - if the user can't be found in the database.

User

protected User(ResultSet rs)
Instantiate a User object based upon the contents of a ResultSet. This is used internally by some of the static methods that return sets of users based upon database queries; e.g. see getUsersAwaitingNameApproval()

Parameters:
rs - The ResultSet object (with the cursor at the current row to be instantiated). Note that this implies that rs.next() has been called at least once.

User

public User(String newUserLogin)
     throws NotFoundException
Instantiate a user object from an existing user account ID

Parameters:
newUserLogin - user login name
Throws:
NotFoundException - if the user can't be found in the database.
Method Detail

__debugTracePeanuts

protected static void __debugTracePeanuts(AbstractUser me)
 theys Jan 7, 2010
 
TO __debugTracePeanuts trace the stack and display the amount of peanuts

Parameters:
me - The user being debugged.

assertUserNameAvailable

public static void assertUserNameAvailable(String userNameRequested)
                                    throws AlreadyUsedException,
                                           ForbiddenUserException

Make the assertion that the user name supplied is available to be requested or assigned to this user.

Note that having another user request the name, which has not been either permitted or denied, will still throw an AlreadyUsedException.

This routine returns void, because it throws exceptions if the name is forbidden or already used. For a boolean version, see isNameAvailable(String)

Parameters:
userNameRequested - The name which is being requested
Throws:
AlreadyUsedException - if the user name has been requested or accepted already
ForbiddenUserException - if the user name is forbidden from use (obscene, gives away personal information, or so forth). See isNameForbidden(String)

canSeeSmartFoxServer

@Deprecated
public static boolean canSeeSmartFoxServer()
Deprecated. 

Check whether the SmartFox Server is available and visible to us (sharing this VM). If so, the static member variable "sfs" will be set to it. Since this is not longer supported, the results will always be false and this method is deprecated.

Returns:
true, if we have access to Smart Fox Server.

configUpdated

public static void configUpdated()
This is the callback that is called whenever the AppiusConfig reloads the configuration or has a runtime configuration value changed. Since User class can use a Whirley cache, this fetches a new instance.


create

public static User create(Date date,
                          String string,
                          String nick)
                   throws AlreadyUsedException,
                          ForbiddenUserException
Create a new user account

Parameters:
date - User's date of birth
string - Character class or type designator
nick - User's requested nickname
Returns:
the new user object
Throws:
AlreadyUsedException - if the nickname is not available
ForbiddenUserException - if the user account is not permitted to be created, e.g. for having an obscene user ID

dangerous__removeTestUsers

public static void dangerous__removeTestUsers()
                                       throws SQLException
Delete test users: test???? accounts with email of testing@tootsville.com will be DESTROYED from the database.

Throws:
SQLException - if it can't be done.

dumpLiveCache

private static void dumpLiveCache()
Print out a nasty, verbose debugging dump of the users live cache to the STDOUT. Toggled on using configuration variable org.starhope.appius.dumpLiveCache


get

public static AbstractUser get(org.json.JSONObject object)
Pick up a user from a JSON object containing either the ID or login (user name) string

Parameters:
object - A JSON object with either an { id: userID } or { login: userName }
Returns:
the User thusly fetched

getActiveItemByTypeAndUserID

public static org.starhope.appius.game.inventory.InventoryItem getActiveItemByTypeAndUserID(int typeID,
                                                                                            int userID)
WRITEME: Document this field. theys Dec 16, 2009

Parameters:
typeID - WRITEME
userID - WRITEME
Returns:
WRITEME

getActiveItemByTypeAndUserID

public static org.starhope.appius.game.inventory.InventoryItem getActiveItemByTypeAndUserID(InventoryItemType type,
                                                                                            int userID)
WRITEME: Document this field. theys Dec 16, 2009 WRITEME

BRP: I believe the idea here is to bypass actually instantiating an user object just to acquire one's inventory

Parameters:
type - The item type
userID - the user whose inventory we want
Returns:
the first item of that type that the user has equipped

getByID

public static AbstractUser getByID(int id)
Instantiate a user object from an existing user account ID

Parameters:
id - The user ID to instantiate
Returns:
the instantiated user record, or null if the user ID doesn't represent a user record (too high, or the record was destroyed somehow) — not returned for deleted or banned accounts, though.

getByLogin

public static AbstractUser getByLogin(String login)
Parameters:
login - the user login name
Returns:
the User record, or null if no user currently has that login name

getByMail

public static AbstractUser[] getByMail(String mail)
Returns an array of all users associated with a given eMail address. This includes all users who report it as being their own eMail address, as well as the children of any parents using it.

Parameters:
mail - The eMail address for which we are searching
Returns:
An array of any/all such users. If the array consists only of one element, which is the value "null," then there are too many results and special effort is required to recall the list.

getByRequestedName

public static User getByRequestedName(String userNameRequested)
Get the user who has requested a certain name, if any.

Parameters:
userNameRequested - the user name for which we're searching
Returns:
null, if no user has requested the name; otherwise, the user who requested it. (Note that the name might have been approved, or might not have been.)

getIDForLiveUserName

public static int getIDForLiveUserName(String name)
Find the user name for a user who is currently signed on.

Parameters:
name - User name to look up
Returns:
The user ID number, if the user is online; else -1

getIDForLogin

public static int getIDForLogin(String name)
Fetch the user ID number for a user name

Parameters:
name - The user name (login)
Returns:
the user ID

getIDForUserName

@Deprecated
public static int getIDForUserName(String name)
Deprecated. getIDForLogin(String)

Fetch the user ID number for a user name

Parameters:
name - The user name (login)
Returns:
the user ID

getRev

public static String getRev()
Returns:
the Subversion revision number of this file

getSystemUser

public static AbstractUser getSystemUser()
Get the System user object (the user which represents the system program itself). In particular, the System object's eMail address and givenName are used to address mail to users.

Returns:
the System user object

getUserNameForID

public static String getUserNameForID(int id)
Parameters:
id - The user ID value
Returns:
The user's login name

getUsersAwaitingNameApproval

public static Collection<AbstractUser> getUsersAwaitingNameApproval()
Get up to 20 users who are awaiting approval of their names. Will not return more than 20 users in a set, but could return an empty set.

Returns:
A set of users who are awaiting name approval

getZ$Z

public static String[] getZ$Z()
Z$Z

Returns:
Z$Z

instantiateUser

private static User instantiateUser(ResultSet rs)
Instantiate a User (using the selected subclass) from the result set garnered from a SELECT *

Parameters:
rs - The given database record
Returns:
The User (subclass) representing that database record

isItGood

public static void isItGood()
Perform basic self-tests upon the User database to identify whether things are good enough to proceed with booting.


isNameAvailable

public static boolean isNameAvailable(String name)
Determine whether the given name is potentially available for use. Returns false if the name has already been forbidden (by virtue of matching a negative filter rule, or having been previously denied to another user), or if the name is currently either in use or requested by another user.

Parameters:
name - The user name being checked
Returns:
true, if the name can potentially be tried.

isNameForbidden

public static boolean isNameForbidden(String userNameRequested)
Determine whether a name is forbidden

... A user name is “forbidden” if it matches a negative filter (if it contains forbidden word(s) or phrase(s)), or if it has previously been banned for some reason

Parameters:
userNameRequested - The name to be checked
Returns:
True, if the requested name is forbidden

isNameValid

public static boolean isNameValid(String userName)
Determines whether the name provided contains allowed characters for an user name.

Parameters:
userName - the user name to be checked
Returns:
true, if the name consists of valid characters

acceptAdminMessage

@Deprecated
public void acceptAdminMessage(AbstractRoom room,
                                          String string)
Deprecated. use acceptAdminMessage(String, String, String) instead

Specified by:
acceptAdminMessage in interface AbstractUser
Parameters:
room - Ignored
string - The administrative message
See Also:
acceptAdminMessage(Integer, String)

acceptAdminMessage

@Deprecated
public void acceptAdminMessage(Integer room,
                                          String string)
Deprecated. use acceptAdminMessage(String, String, String) instead

Accept a message from an administrator or the system. If the user is connected, propagate that message to their client.

Specified by:
acceptAdminMessage in interface AbstractUser
Parameters:
room - The room in which the administrative message is being sent (ignored)
string - The administrative message.

acceptAdminMessage

public void acceptAdminMessage(String message,
                               String title,
                               String label)
Send an administrative or moderator message to the client

Specified by:
acceptAdminMessage in interface AbstractUser
Parameters:
message - The body of the message
title - The non-scrolling title
label - The label to apply to the corner of the message box

acceptErrorReply

public void acceptErrorReply(String command,
                             String error,
                             org.json.JSONObject result,
                             AbstractRoom room)
Specified by:
acceptErrorReply in interface AbstractUser
Parameters:
command - WRITEME
error - WRITEME
result - WRITEME
room - WRITEME
See Also:
AbstractUser.acceptErrorReply(java.lang.String, java.lang.String, org.json.JSONObject, org.starhope.appius.game.AbstractRoom)

acceptGameAction

public void acceptGameAction(AbstractUser sender,
                             org.json.JSONObject action)
This is an overriding method.

Specified by:
acceptGameAction in interface RoomListener
Parameters:
sender - the sender
action - The game action. The verb is in action.getString("action").
See Also:
RoomListener.acceptGameAction(AbstractUser, JSONObject)

acceptGameStateChange

public void acceptGameStateChange(GameEvent gameCode,
                                  GameStateFlag gameState)
This is an overriding method.

Specified by:
acceptGameStateChange in interface RoomListener
Parameters:
gameCode - The GameEvent whose state is changing
gameState - The new state
See Also:
RoomListener.acceptGameStateChange(org.starhope.appius.game.GameEvent, org.starhope.appius.game.GameStateFlag)

acceptMessage

public void acceptMessage(String title,
                          String caption,
                          String message)
Accept an administrative/moderator message with the full range of options

Specified by:
acceptMessage in interface AbstractUser
Parameters:
title - The title of the message
caption - The caption; usually ADMIN for administrative messages
message - The message body text

acceptObjectJoinRoom

public void acceptObjectJoinRoom(AbstractRoom room,
                                 AbstractUser object)
Accept notification of a user or object joining the room.

Parameters:
room - the room in question
object - the object leaving the room
See Also:
RoomListener.acceptObjectJoinRoom(AbstractRoom, RoomListener)

acceptObjectJoinRoom

public void acceptObjectJoinRoom(AbstractRoom room,
                                 RoomListener object)
Description copied from interface: RoomListener
Notification that someone has entered the room.

Specified by:
acceptObjectJoinRoom in interface RoomListener
Parameters:
room - The room
object - The thing (probably user) entering
See Also:
RoomListener.acceptObjectJoinRoom(org.starhope.appius.game.AbstractRoom, org.starhope.appius.game.RoomListener)

acceptObjectPartRoom

public void acceptObjectPartRoom(AbstractRoom room,
                                 RoomListener object)
Accept notification of a user or object departing the room.

Specified by:
acceptObjectPartRoom in interface RoomListener
Parameters:
room - The room
object - The thing (probably user) departing
See Also:
RoomListener.acceptObjectPartRoom(AbstractRoom, RoomListener)

acceptOutOfBandMessage

public void acceptOutOfBandMessage(AbstractUser sender,
                                   AbstractRoom room,
                                   org.json.JSONObject body)
Accept an out-of-band message from a room.

Specified by:
acceptOutOfBandMessage in interface RoomListener
Parameters:
sender - The user transmitting the out-of-band message
body - The contents of that message (in JSO)
room - The room in which the sender is found — and, typically, also this recipient.

acceptPrivateMessage

public void acceptPrivateMessage(AbstractUser from,
                                 String message)
Accept an incoming private message (“whisper”) from another user.

Parameters:
from - The user “whispering” to this one
message - The contents of the message

acceptPublicMessage

public void acceptPublicMessage(AbstractUser sender,
                                AbstractRoom room,
                                String message)
This is an overriding method.

Specified by:
acceptPublicMessage in interface RoomListener
Parameters:
sender - The speaker
room - The room in which the words were spoken
message - The spoken text or /emote
See Also:
RoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser, org.starhope.appius.game.AbstractRoom, java.lang.String)

acceptPublicMessage

public void acceptPublicMessage(AbstractUser from,
                                String message)
This is an overriding method.

Specified by:
acceptPublicMessage in interface RoomListener
Parameters:
from - The speaker
message - The spoken text or /emote
See Also:
RoomListener.acceptPublicMessage(org.starhope.appius.user.AbstractUser, java.lang.String)

acceptSuccessReply

@Deprecated
public void acceptSuccessReply(AbstractZone zone,
                                          AbstractRoom room,
                                          String command,
                                          org.json.JSONObject jsonData)
Deprecated. for shorter acceptSuccessReply(String, JSONObject, AbstractRoom)

This is an overriding method.

Specified by:
acceptSuccessReply in interface AbstractUser
Parameters:
zone - WRITEME
room - WRITEME
command - WRITEME
jsonData - WRITEME
See Also:
AbstractUser.acceptSuccessReply(org.starhope.appius.types.AbstractZone, org.starhope.appius.game.AbstractRoom, java.lang.String, org.json.JSONObject)

acceptSuccessReply

public void acceptSuccessReply(String command,
                               org.json.JSONObject jsonData,
                               AbstractRoom room)
Specified by:
acceptSuccessReply in interface AbstractUser
Parameters:
command - the command sending the successful reply
jsonData - additional JSON data
room - the room in which the success happened

addBuddy

public void addBuddy(AbstractUser newBuddy)
Adds a user to this user's buddy list. Note that this does not implement the buddy-request functionality at this level, that's implemented by the client at present.

Specified by:
addBuddy in interface AbstractUser
Parameters:
newBuddy - the user to be the new buddy

addDefaultFreeItem

public void addDefaultFreeItem(int id)
Identical to @link addDefaultFreeItem(int, boolean) with “false” for the second parameter

Parameters:
id - the item ID.

addDefaultFreeItem

public void addDefaultFreeItem(int id,
                               boolean forceActive)
Add an item which every user gets for free to the user's inventory, if it does not already exist. This method is used to enforce a minimum inventory upon users. Examples of default free items include the Basic 8 Toots patterns, and the default TootBook theme.

Parameters:
id - the item ID
forceActive - if true, force the item to be active upon adding it to the user's inventory

addFreeClothing

protected void addFreeClothing(org.starhope.appius.game.inventory.ClothingItem clothingItem)
Parameters:
clothingItem - The item to be added to the user's inventory as a free gift (or prize)

addGiftSubscription

public void addGiftSubscription(int months,
                                int days)

Create a gift subscription for a user, to last the given number of months plus the given number of days.

To create a lifetime subscription, provide 1000 as the number of months.

Specified by:
addGiftSubscription in interface AbstractUser
Parameters:
months - either 1000 (or any greater value over 1000) for a lifetime subscription, or, the number of months for a gift subscription.
days - the number of days for a gift subscription. Ignored for lifetime subscriptions.

addItem

public void addItem(int itemID)
Add an item to the user's inventory.

Specified by:
addItem in interface AbstractUser
Parameters:
itemID - The item's database ID number.

addItem

public void addItem(org.starhope.appius.game.inventory.InventoryItem item)
Add an item to the user's inventory. This does not conduct a purchase event.

Parameters:
item - The item to be added to inventory.

addRoom

public void addRoom(int roomNumber)
Parameters:
roomNumber - add a room to the user's house

affirmFreeMember

protected void affirmFreeMember()
Affirm that this is a free (non-premium) member and remove clothing and patterns.


affirmPaidMember

public void affirmPaidMember()
Ensure that this user has the benefits of being a paid member, effective immediately


approveName

public void approveName(AbstractUser abstractUser)
                 throws PrivilegeRequiredException
Approve the user's requested name, and make it active

Parameters:
abstractUser - the user approving the name (requires moderator privileges)
Throws:
PrivilegeRequiredException - if the user approving the name does not have moderator privileges

assertStaffLevel

public void assertStaffLevel(int staffLevelNeeded)
                      throws PrivilegeRequiredException
Assert that this user must have the given staff level (or greater). Throws an exception if this is untrue.

Specified by:
assertStaffLevel in interface AbstractUser
Parameters:
staffLevelNeeded - The minimum staff level which is being asserted
Throws:
PrivilegeRequiredException - if the minimum staff level is not met.

attend

public void attend(AbstractUser otherGuy)
Attend to an user who may previously have been ignored

Specified by:
attend in interface AbstractUser
Parameters:
otherGuy - the user to whom to now attend

ban

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

Specified by:
ban in interface AbstractUser
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

blog

public void blog(String message)
send a message with various debugging information to the journals

Parameters:
message - the message to be recorded

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.

cancelEvent

public void cancelEvent(int eventID)
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Jan 15, 2010)

Specified by:
cancelEvent in interface AbstractUser
Parameters:
eventID - the event ID to be canceled

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()
Specified by:
canTalk in interface AbstractUser
Returns:
the canTalk

changed

public void changed()
This is an overriding method.

Overrides:
changed in class SQLPeerDatum
See Also:
SQLPeerDatum.changed()

changeRoom

public AbstractRoom changeRoom(AbstractRoom room)
Parameters:
room - the new room to be joined
Returns:
the old room which was departed (if any)

checkPassword

public boolean checkPassword(String passwordGuess)
Description copied from class: Person
Returns true if the password is correct. Returns false if password is not set or the guess was blank.

Overrides:
checkPassword in class Person
Parameters:
passwordGuess - the supplied password that we want to check
Returns:
true, if the password supplied is correct

compareTo

public int compareTo(User o)
This is an overriding method.

Specified by:
compareTo in interface Comparable<User>
Parameters:
o - The other user
Returns:
the two users compared based upon user display names
See Also:
Comparable.compareTo(java.lang.Object)

deleteMail

public boolean deleteMail(int messageID)
Mark a message as being deleted in the messages database.

Parameters:
messageID - The message ID to be marked as deleted.
Returns:
true if anything were deleted

deleteVariable

public void deleteVariable(String key)
This is an overriding method.

Specified by:
deleteVariable in interface HasVariables
Parameters:
key - WRITEME
See Also:
HasVariables.deleteVariable(java.lang.String)

doff

public void doff(org.starhope.appius.game.inventory.ClothingItem item)
Doff a wearable item

Parameters:
item - the item to be removed
See Also:
wear(ClothingItem)

doffClothes

public void doffClothes()
Get naked

Specified by:
doffClothes in interface AbstractUser

doffPatterns

public void doffPatterns()
Get bare


doffPivitz

public void doffPivitz()
Remove Pivitz


endEventPurchaseRaw

public void endEventPurchaseRaw(int eventID,
                                int itemID)
                         throws NotFoundException,
                                NonSufficientFundsException,
                                AlreadyExistsException
WRITEME: document this method (brpocock, Aug 31, 2009)

Parameters:
eventID - WRITEME
itemID - WRITEME
Throws:
NotFoundException - WRITEME
NonSufficientFundsException - WRITEME
AlreadyExistsException - WRITEME

endEventPurchaseRaw

protected abstract void endEventPurchaseRaw(int eventID,
                                            ItemCreationTemplate itemCreationTemplate)
                                     throws NotFoundException,
                                            NonSufficientFundsException,
                                            AlreadyExistsException
WRITEME: document this method (brpocock, Dec 30, 2009)

Parameters:
eventID - WRITEME
itemCreationTemplate - WRITEME
Throws:
NotFoundException - WRITEME
NonSufficientFundsException - WRITEME
AlreadyExistsException - WRITEME

endMultiplayerEvent

public abstract org.json.JSONObject endMultiplayerEvent(int eventID,
                                                        String moniker,
                                                        String gameCode,
                                                        BigDecimal score,
                                                        LinkedHashMap<Integer,Integer> scores)
                                                 throws org.json.JSONException
end a multiplayer event … WRITEME details?

Parameters:
eventID - the event instance ID
moniker - the moniker of the event in progress
gameCode - the game code of the multiplayer game event
score - the score of this player
scores - the set of user ID's and scores of all players
Returns:
the JSON object describing the end of this event
Throws:
org.json.JSONException - if the event's results can't be expressed in JSON

endMultiplayerEvent

public org.json.JSONObject endMultiplayerEvent(Integer eventID,
                                               String gameMoniker,
                                               String gameCode,
                                               BigDecimal playerScoreDecimal,
                                               LinkedHashMap<Integer,Integer> sortedScores)
                                        throws org.json.JSONException
This is an overriding method.

Specified by:
endMultiplayerEvent in interface AbstractUser
Parameters:
eventID - WRITEME
gameMoniker - WRITEME
gameCode - WRITEME
playerScoreDecimal - WRITEME
sortedScores - WRITEME
Returns:
WRITEME
Throws:
org.json.JSONException - WRITEME
See Also:
AbstractUser.endMultiplayerEvent(java.lang.Integer, java.lang.String, java.lang.String, java.math.BigDecimal, java.util.LinkedHashMap)

equals

public boolean equals(Object o)
This is an overriding method.

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

equals

public boolean equals(User o)
Determine if two user objects are identical. Two objects are equal if they have both the same serial number and user ID.

Parameters:
o - the other user
Returns:
true, if the two instances are totally identical

equip

public void equip(org.starhope.appius.game.inventory.InventoryItem item)
           throws GameLogicException
Equip an item

Parameters:
item - The item to be equipped
Throws:
GameLogicException - if the user does not have the item

fetch_avatarInfo

protected void fetch_avatarInfo(ResultSet resultSet)
                         throws SQLException
Fetch the user's avatar information from the database

Parameters:
resultSet - database record to interpret
Throws:
SQLException - if the record can't be interpreted
See Also:
set(ResultSet)

fetch_chatColours

protected void fetch_chatColours(ResultSet resultSet)
                          throws SQLException
Fetch the chat colours for this user from the database

Parameters:
resultSet - database record to interpret
Throws:
SQLException - if the record can't be interpreted
See Also:
set(ResultSet)

fetch_dobInfo

protected void fetch_dobInfo(ResultSet resultSet)
                      throws SQLException
Fetch the user's date of birth and related information from the database record provided

Parameters:
resultSet - database record to interpret
Throws:
SQLException - if the record can't be interpreted
See Also:
set(ResultSet)

fetch_inventory

private void fetch_inventory()
                      throws SQLException
Sub-fetch routine called by set(ResultSet) to handle inventory load.

Throws:
SQLException - if the underlying inventory record(s) is/are corrupted in some way
See Also:
set(ResultSet)

fetch_language

protected void fetch_language(ResultSet resultSet)
                       throws SQLException
Fetch the user's language and dialect information from the database record

Parameters:
resultSet - the database record from which to be loaded
Throws:
SQLException - if the record can't be interpreted
See Also:
set(ResultSet)

fetch_laston

protected void fetch_laston()
                     throws SQLException
Fetch the user's last activity information from the database record

Throws:
SQLException - if the record can't be interpreted.
See Also:
set(ResultSet)

fetch_mailInfo

protected void fetch_mailInfo(ResultSet resultSet)
                       throws SQLException
Fetch the user's eMail info from the database record

Parameters:
resultSet - database record to interpret
Throws:
SQLException - if the record can't be interpreted
See Also:
set(ResultSet)

fetch_more

protected void fetch_more(ResultSet resultSet)
                   throws SQLException
Fetch additional results fields from a database record — mostly intended to be overridden by derived classes

Parameters:
resultSet - WRITEME
Throws:
SQLException - WRITEME

fetch_parentInfo

protected void fetch_parentInfo(ResultSet resultSet)
                         throws SQLException
Fetch information about the user's parent (if any).

Parameters:
resultSet - database record to interpret
Throws:
SQLException - if the record can't be interpreted
See Also:
set(ResultSet)

fetch_passwordResetInfo

protected void fetch_passwordResetInfo(ResultSet resultSet)
                                throws SQLException
Fetch the password reset question and answer from the provided database record. See set(ResultSet)

Parameters:
resultSet - the database record
Throws:
SQLException - If the records can't be found, or are in an invalid format of some kind

fetch_permissionsInfo

protected void fetch_permissionsInfo(ResultSet resultSet)
                              throws SQLException
Fetch the permissions-related portion of a user's record out of the SQL ResultSet. Used while populating the record from the database.

Parameters:
resultSet - The ResultSet being used to set the user up.
Throws:
SQLException - if the data in the record can't be interpreted.
See Also:
set(ResultSet)

fetch_userBasicInfo

protected void fetch_userBasicInfo(ResultSet resultSet)
                            throws SQLException
Fetch the user's basic information: user ID, user name, and password — from the provided database record

Parameters:
resultSet - database record to interpret
Throws:
SQLException - if the record can't be interpreted
See Also:
set(ResultSet)

flush

public abstract void flush()
Specified by:
flush in class Person
See Also:
Person.flush()

flush_breakOut_chatColours

protected void flush_breakOut_chatColours(PreparedStatement update,
                                          int bgColumnNumber,
                                          int fgColumnNumber)
                                   throws SQLException
WRITEME: document this method (brpocock, Jan 8, 2010)

Parameters:
update - WRITEME
bgColumnNumber - WRITEME
fgColumnNumber - WRITEME
Throws:
SQLException - WRITEME
See Also:
flush()

flush_breakOut_dob

protected void flush_breakOut_dob(PreparedStatement update)
                           throws SQLException
Breakout of the flush operation to update the user's date of birth and age group

Parameters:
update - the prepared statement for the update
Throws:
SQLException - if the data can't be stored into the pending update

flush_breakOut_language

protected void flush_breakOut_language(PreparedStatement update)
                                throws SQLException
WRITEME: document this method (brpocock, Sep 23, 2009)

Parameters:
update - WRITEME
Throws:
SQLException - WRITEME
See Also:
flush()

flush_breakOut_loginPass

protected void flush_breakOut_loginPass(PreparedStatement update)
                                 throws SQLException
WRITEME: document this method (brpocock, Sep 23, 2009)

Parameters:
update - WRITEME.
Throws:
SQLException - WRITEME
See Also:
flush()

flush_breakOut_mail

protected void flush_breakOut_mail(PreparedStatement update)
                            throws SQLException
Flush the user's eMail information to the database

Parameters:
update - The database PreparedStatement from flush()
Throws:
SQLException - if the record can't be prepared for update
See Also:
flush()

flush_breakOut_nameRequest

protected void flush_breakOut_nameRequest(PreparedStatement update)
                                   throws SQLException
Prepare the name-request details for flush()

Parameters:
update - the PreparedStatement to be updated
Throws:
SQLException - if the data can't be set up for some reason
See Also:
flush()

flush_breakOut_parent

protected void flush_breakOut_parent(PreparedStatement update)
                              throws SQLException
Prepare the user's parent's details for flush()

Parameters:
update - the PreparedStatement to be updated
Throws:
SQLException - if the data can't be set up for some reason
See Also:
flush()

flush_breakOut_permissions

protected void flush_breakOut_permissions(PreparedStatement update)
                                   throws SQLException
set permissions for a database flush

Parameters:
update - the SQL statement being prepared
Throws:
SQLException - if the data can't be prepared for SQL injection
See Also:
flush()

flush_breakOut_referer

protected void flush_breakOut_referer(PreparedStatement update,
                                      int column)
                               throws SQLException
Prepare the “referer” field for flush()

Parameters:
update - the PreparedStatement for update
column - the referer column number in the database
Throws:
SQLException - if the SQL can't be set up
See Also:
flush()

forgotPassword

public boolean forgotPassword(String forgottenPasswordQ,
                              String forgottenPasswordA)
Send the user their forgotten password if they know the answer to their secret question.

Overrides:
forgotPassword in class Person
Parameters:
forgottenPasswordQ - The question being answered
forgottenPasswordA - The answer provided
Returns:
true if answer is correct and false if it is not also triggers the send password e-mail if correct.

generateSystemName

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


getActiveClothing

public org.json.JSONObject getActiveClothing()
Returns:
A JSON array of clothing being worn (including pattern and Pivitz) in the order preferred by the client

getActiveDecorations

public Collection<org.starhope.appius.game.inventory.HomeDecorItem> getActiveDecorations(int roomNumber)
                                                                                  throws NotFoundException
get the decorations active (placed) in a room of this user's house

Specified by:
getActiveDecorations in interface AbstractUser
Parameters:
roomNumber - which room of the user's house
Returns:
home décor items in this room
Throws:
NotFoundException - if the room does not exist

getActiveItemByType

public org.starhope.appius.game.inventory.InventoryItem getActiveItemByType(InventoryItemType t)
Returns the active item for an item type.

Parameters:
t - An Item type to match by.
Returns:
The active inventory item for type t
See Also:
InventoryItem.identifiesAs(String)

getActiveItemByType

public org.starhope.appius.game.inventory.InventoryItem getActiveItemByType(String t)
Returns the active item for an item type.

Parameters:
t - A string of the item type. Use Constants from InventoryItem
Returns:
The active inventory item for type t
See Also:
InventoryItem.identifiesAs(String)

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.

Specified by:
getAge in interface AbstractUser
Returns:
The user's legal age, in years.

getAgeGroup

public AgeBracket getAgeGroup()
Returns:
the ageGroup

getApprovalCookie

public abstract String getApprovalCookie()
Description copied from class: Person
Get a cookie object for sending mail. Cookies are generated differently between User and Parent.

Specified by:
getApprovalCookie in class Person
Returns:
an opaque string that identifies the user uniquely
See Also:
Person.getApprovalCookie()

getApprovedDate

public Date getApprovedDate()
Returns:
the date on which this account was approved

getApprovedDateString

public String getApprovedDateString()
Specified by:
getApprovedDateString in interface AbstractUser
Returns:
Returns an user-visible string describing whether the user has been approved, and if so, when
See Also:
getApprovedDate()

getAvatarClass

public AvatarClass getAvatarClass()
Specified by:
getAvatarClass in interface AbstractUser
Returns:
the avatarClassID

getAvatarLabel

public String getAvatarLabel()
This is an overriding method.

Specified by:
getAvatarLabel in interface AbstractUser
Returns:
The avatar label
See Also:
AbstractUser.getAvatarLabel()

getBaseColor

public Colour getBaseColor()
Returns:
the baseColor

getBirthDate

public Date getBirthDate()
Returns:
the birthDate

getBuddyList

public UserList getBuddyList()
Get the user's buddy list (a UserList)

Returns:
the user's buddy list

getBuddyListNames

public Collection<String> getBuddyListNames()
Get the names of everyone on the user's buddy list. See getBuddyList()

Specified by:
getBuddyListNames in interface AbstractUser
Returns:
set of user strings

getBuddyListNamesAsArray

public String[] getBuddyListNamesAsArray()
Get the names of everyone on the user's buddy list.

Returns:
String array of user names

getCacheUniqueID

protected String getCacheUniqueID()
This is an overriding method.

Specified by:
getCacheUniqueID in class SQLPeerDatum
Returns:
The local (Stringified) version of an unique ID; usually the database ID column
See Also:
SQLPeerDatum.getCacheUniqueID()

getChatBG

public Colour getChatBG()
Returns:
the chat background colour

getChatFG

public Colour getChatFG()
Returns:
the chat foreground colour

getConfirmationTemplate

public String getConfirmationTemplate()
This is an overriding method.

Specified by:
getConfirmationTemplate in class Person
Returns:
the template filename to be used for confirming this account
See Also:
Person.getConfirmationTemplate()

getConnectedFrom

public String getConnectedFrom()
Get the IP address or hostname from which the user is connected (if we can tell). See isOnline() for the usual caveats

Returns:
Hostname "/" IP address. Hostname is often absent.

getDialect

public String getDialect()
Specified by:
getDialect in interface AbstractUser
Overrides:
getDialect in class Person
Returns:
the dialect

getDisplayName

public String getDisplayName()
Description copied from class: Person
This method's only use is for more closely aligning User and Parent classes. Since Parent class does not have a user name, it returns null.

Specified by:
getDisplayName in interface AbstractUser
Specified by:
getDisplayName in class Person
Returns:
null
See Also:
Person.getDisplayName()

getEmailPlusDate

public Date getEmailPlusDate()
Returns:
the emailPlusDate

getEmailPlusDateString

public String getEmailPlusDateString()
Returns:
Returns a user-displayable English string describing when the eMail Plus confirmation happened, if it has.
See Also:
getEmailPlusDate()

getExtraColor

public Colour getExtraColor()
Returns:
the extraColor

getFacing

public String getFacing()
Description copied from interface: AbstractUser
Get the string identifying the direction which this object is facing. One of: N,S,E,W,NE,NW,SW,SE.

Specified by:
getFacing in interface AbstractUser
Returns:
the facing

getFurnitureBySlot

public org.starhope.appius.game.inventory.HomeDecorItem getFurnitureBySlot(int slotNumber)
                                                                    throws NotFoundException
Specified by:
getFurnitureBySlot in interface AbstractUser
Parameters:
slotNumber - WRITEME
Returns:
the home décor item in the given inventory slot
Throws:
NotFoundException - WRITEME

getGameEquipItem

private org.starhope.appius.game.inventory.GameEquipItem getGameEquipItem()
If the user has a game item equipped (e.g. a key), then get that item. Otherwise, returns null.

Returns:
the game item currently being carried / currently equipped, or null if no item is equipped.

getGameFlag

public boolean getGameFlag(String name)
Return the status of the indicated game flag. Note that all game flags default to false.

Parameters:
name - The unique identifier for the game flag
Returns:
the state (or presence) of the flag

getGivenName

public String getGivenName()
Overrides:
getGivenName in class Person
Returns:
the given name of the user, if one were set.

getHistory

public HashMap<Timestamp,HashMap<String,String>> getHistory(Date after,
                                                            int limit)
Returns the historical contents of this user's record.

Specified by:
getHistory in class Person
Parameters:
after - If non-null, specifies the date after which we want to view records. To see all records, back to the creation of the user record, supply a null.
limit - If this is a positive number, it limits the results to this number of records.
Returns:
A map of timestamps to key/value pairs. All values are expressed as strings (even though they may have numeric, enumerative, or date / datetime types in the database), since this is primarily (only?) for human-viewable auditing.

getIgnoreList

public UserList getIgnoreList()
Returns:
the other users being ignored by this one

getInventory

protected HashSet<org.starhope.appius.game.inventory.InventoryItem> getInventory()
Returns:
the inventory

getIpAddress

@Deprecated
public String getIpAddress()
Deprecated. Smart Fox Server misspelling of getIPAddress()

Returns:
The string form of the user's IP address (may be IPv4 or IPv6)

getIPAddress

public String getIPAddress()
Specified by:
getIPAddress in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getIPAddress()

getItemsByType

public Collection<org.starhope.appius.game.inventory.InventoryItem> getItemsByType(String typeString)
Get all items that identify as the type string. See InventoryItem.identifiesAs(String) for the canonical list.

Specified by:
getItemsByType in interface AbstractUser
Parameters:
typeString - A type string specified in InventoryItem.identifiesAs(String)
Returns:
an array of inventory items that identify as the given type
See Also:
InventoryItem.identifiesAs(String)

getItemsByType

public Collection<org.starhope.appius.game.inventory.InventoryItem> getItemsByType(String[] types)
WRITEME: document this method (brpocock, Aug 28, 2009)

Parameters:
types - The set of types of inventory items which are wanted
Returns:
get items in the
See Also:
InventoryItem.identifiesAs(String)

getItemsByTypeAsArray

public org.starhope.appius.game.inventory.InventoryItem[] getItemsByTypeAsArray(String typeString)
Get all items that identify as the type string. See InventoryItem.identifiesAs(String) for the canonical list.

Parameters:
typeString - A type string specified in InventoryItem.identifiesAs(String)
Returns:
an array of inventory items that identify as the given type
See Also:
InventoryItem.identifiesAs(String)

getKickedByUserID

public int getKickedByUserID()
Specified by:
getKickedByUserID in interface AbstractUser
Returns:
the user ID by which this user was kicked (or banned)

getKickedMessage

public String getKickedMessage()
Specified by:
getKickedMessage in interface AbstractUser
Returns:
the message explaining the user being kicked (or banned)

getKickedReasonCode

public String getKickedReasonCode()
Specified by:
getKickedReasonCode in interface AbstractUser
Returns:
the kickedReasonCode

getKickedUntil

public Timestamp getKickedUntil()
Description copied from interface: AbstractUser
String?? TODO? FIXME?

Specified by:
getKickedUntil in interface AbstractUser
Returns:
the kickedUntil

getLastActive

public Timestamp getLastActive()
Returns:
the time at which the user last was logged on or active

getLastZone

public String getLastZone()
Returns:
the last (or current) zone for the player

getLocation

public RoomAndZone getLocation()
Get the user's current location (room and zone) if the user is online; or, “null” if the user is not online.

Specified by:
getLocation in interface RoomListener
Returns:
room and zone

getLogin

public String getLogin()
Returns:
the user's login

getMySerial

public int getMySerial()
Returns:
the mySerial

getName

public String getName()
Returns:
Get the user's login name

getNameApprovedAt

public Timestamp getNameApprovedAt()
Specified by:
getNameApprovedAt in interface AbstractUser
Returns:
The time at which the user's name was approved, if it has been (null if not).

getNameApprovedByUserID

public long getNameApprovedByUserID()
Returns:
the user ID of the moderator who approved this user's name, if approved. (-1 if not)

getNameRequestedAt

public Timestamp getNameRequestedAt()
Specified by:
getNameRequestedAt in interface AbstractUser
Returns:
the date & time at which the moderator approved this user's name, if approved (null if not).

getParent

public Parent getParent()
Returns:
this user's parent (if any) — null if none.

getParentApprovedName

public boolean getParentApprovedName()
Returns:
true, if the parent has approved this user's name

getParentID

public int getParentID()
Returns:
the ID number of this user's parent, if any (-1 if none)

getPassport_JSON

public org.json.JSONObject getPassport_JSON()
                                     throws SQLException,
                                            org.json.JSONException
Returns:
a JSON object representing the user's Passport.
Throws:
SQLException - if the passport records can't be obtained or interpreted
org.json.JSONException - if the passport can't be represented in JSON form

getPotentialUserName

public String getPotentialUserName()
This is an overriding method.

Specified by:
getPotentialUserName in class Person
Returns:
a user name that could be used
See Also:
Person.getPotentialUserName()

getPublicInfo

public org.json.JSONObject getPublicInfo()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009) avatar, userName, clothes, colors

Specified by:
getPublicInfo in interface AbstractUser
Returns:
JSONObject 'self' including userName and avatarClass

getReferer

public String getReferer()
Get the referral/affiliate code from this user's initial signup

Returns:
the referral or affiliate code

getRegisteredAt

public Timestamp getRegisteredAt()
Returns:
the registeredAt

getRegisteredDate

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

getRegisteredDateString

public String getRegisteredDateString()
Specified by:
getRegisteredDateString in interface AbstractUser
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.

Specified by:
getResponsibleMail in interface AbstractUser
Specified by:
getResponsibleMail in class Person
Returns:
the eMail address

getRoom

public AbstractRoom getRoom()
Description copied from interface: RoomListener
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
getRoom in interface RoomListener
Returns:
The room in which the user currently exists. This might potentially be null.

getRoomNumber

public int getRoomNumber()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Jan 11, 2010)

Specified by:
getRoomNumber in interface AbstractUser
Returns:
the number of the user's current room; or -1 if the user isn't in any room

getSerial

public long getSerial()
Get the unique instance serial number for this instance of this user. Ideally, there should never be two instances of the same user in core at once; these serial numbers are used for debugging to be able to detect if that were to happen.

Returns:
the unique instance serial number

getServerThread

public AppiusClaudiusCaecus getServerThread()
Get the Appius Claudius Caecus server thread (if any) associated with this User (if they are logged-in).

Specified by:
getServerThread in interface AbstractUser
Returns:
the active server thread, or null

getStaffLevel

public int getStaffLevel()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Jan 11, 2010)

Specified by:
getStaffLevel in interface AbstractUser
Returns:
the staffLevel

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

getTargetX

public double getTargetX()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
getTargetX in interface AbstractUser
Returns:
the targetX

getTargetY

public double getTargetY()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
getTargetY in interface AbstractUser
Returns:
the targetY

getTravelRate

public double getTravelRate()
This is an overriding method.

Specified by:
getTravelRate in interface AbstractUser
Returns:
WRITEME
See Also:
AbstractUser.getTravelRate()

getTravelStart

public long getTravelStart()
This is an overriding method.

Specified by:
getTravelStart in interface AbstractUser
Returns:
the time at which the object started moving (msec since epoch)
See Also:
AbstractUser.getTravelStart()

getUserEnrolments

public Collection<UserEnrolment> getUserEnrolments()
Returns:
all enrolments for this user

getUserEnrolmentsAsArray

public UserEnrolment[] getUserEnrolmentsAsArray()
Returns:
all enrolments for this user

getUserID

public int getUserID()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
getUserID in interface AbstractUser
Returns:
the userID

getUserName

public String getUserName()
Returns:
the user's login

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.

getUserVariables

public HashMap<String,String> getUserVariables()
Get all user variables in a hash map

Specified by:
getUserVariables in interface AbstractUser
Returns:
A hashmap containing all user variables

getVariable

public String getVariable(String string)
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
getVariable in interface HasVariables
Specified by:
getVariable in interface AbstractUser
Parameters:
string - WRITEME
Returns:
WRITEME

getX

public double getX()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
getX in interface AbstractUser
Returns:
the x

getY

public double getY()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
getY in interface AbstractUser
Returns:
the y

getZone

public AbstractZone getZone()
Get the user's current Zone, if the user is online.

Specified by:
getZone in interface RoomListener
Returns:
the current zone of the user, if any. Null if the user is offline.

hashCode

public int hashCode()
Get a (hopefully unique) hash code for this user.

Overrides:
hashCode in class Object
See Also:
Object.hashCode()

hasItem

public boolean hasItem(int id)
Determine whether this user has this item

Parameters:
id - The item ID
Returns:
true, if the user has the item

hasItem

public boolean hasItem(org.starhope.appius.game.inventory.InventoryItem item)
determine whether the user has an item

Parameters:
item - the item in question
Returns:
true, if the user has the given item; else, false

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.

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

hasVariable

public boolean hasVariable(String string)
This is an overriding method.

Specified by:
hasVariable in interface AbstractUser
Parameters:
string - WRITEME
Returns:
WRITEME
See Also:
AbstractUser.hasVariable(java.lang.String)

ignore

public void ignore(AbstractUser otherUser)
Calling this method indicates that this user wants to ignore the other specified user.

Specified by:
ignore in interface AbstractUser
Parameters:
otherUser - The user, whom this user wishes to ignore

insertIntoDatabase

protected abstract void insertIntoDatabase(Date birthDate1)
WRITEME: document this method (brpocock, Jan 4, 2010)

Parameters:
birthDate1 - WRITEME

invalidateCache

public void invalidateCache()
Invalidate the live cache records of this user after s/he has signed off.


isActive

public boolean isActive()
Returns:
true, if this is an active user account (able to sign in, potentially)

isApproved

public boolean isApproved()
See approvedDate for discussion

Returns:
true, if this account has been approved, and is still active

isBanned

public boolean isBanned()
Specified by:
isBanned in interface AbstractUser
Returns:
true, if the account is banned (neither active nor canceled)

isBirthday

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

isCanceled

public boolean isCanceled()
Specified by:
isCanceled in interface AbstractUser
Returns:
true if the user account was canceled (not active, nor banned)

isCanContact

public boolean isCanContact()
Description copied from class: Person
TODO: document this method (brpocock, Oct 13, 2009)

Overrides:
isCanContact in class Person
Returns:
the canContact

isCanEnterChatZone

public boolean isCanEnterChatZone()
Returns:
the canEnterChatZone

isCanEnterMenuZone

public boolean isCanEnterMenuZone()
Returns:
the canEnterMenuZone

isCanTalk

public boolean isCanTalk()
Returns:
canTalk()

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.

Specified by:
isKicked in interface AbstractUser
Returns:
true, if the user is kicked offline.

isNeedsNaming

public boolean isNeedsNaming()
Returns whether this account has a system-provided (not user-provided) name, or no name at all, and we need to prompt the user (or parent) to name it.

Returns:
true if this user needs to be named

isNeedsParentAttention

public boolean isNeedsParentAttention()
Returns:
true if there is a flag of some kind on this user, that the parent needs to pay attention to.

isNPC

public boolean isNPC()
Determine whether this user is a player-character, or non-player-character.

Specified by:
isNPC in interface AbstractUser
Returns:
true, if this User is NPC-controlled.

isOnline

public boolean isOnline()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
isOnline in interface AbstractUser
Returns:
true, if the user is online; false, if they're offline (or we can't tell for certain, e.g. we can't see the SmartFox Server / Appius Claudius Caecus)

isPaidMember

public boolean isPaidMember()
Specified by:
isPaidMember in interface AbstractUser
Returns:
true, if the user is a paid member (or staff member)

kick

public void kick(AbstractUser kickedBy,
                 String kickedReason,
                 long kickedMinutes)
          throws PrivilegeRequiredException
Kick a user offline for a number of minutes.

Parameters:
kickedBy - The user who is kicking this user offline
kickedReason - The reason for which s/he is being kicked
kickedMinutes - The duration for which s/he should be kicked, in minutes. Read that again: minutes — not msec!
Throws:
PrivilegeRequiredException - if the person trying to kick this user off doesn't have moderator privileges

kick

public void 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.
Throws:
PrivilegeRequiredException - if the person trying to kick this user off doesn't have moderator privileges

liftBan

public void liftBan(AbstractUser authority)
             throws PrivilegeRequiredException
Lift the ban upon this user.

Specified by:
liftBan in interface AbstractUser
Parameters:
authority - WRITEME
Throws:
PrivilegeRequiredException - WRITEME
See Also:
AbstractUser.liftBan(org.starhope.appius.user.AbstractUser)

local_create

public abstract void local_create()
Hook for special stuff to be done right after a new user account is created


local_publicInfo

protected void local_publicInfo(org.json.JSONObject userInfo)
Append information in the subclass to the already-prepared JSON data for the getPublicInfo call

Parameters:
userInfo - the public info JSON object to which additional info. should be appended

loggedIn

public void loggedIn(String zoneName,
                     AppiusClaudiusCaecus newServerThread)
Parameters:
zoneName - The name of the zone too which the user has logged in
newServerThread - The server thread in which the user is logged in

loggedIn

@Deprecated
public void loggedIn(String zoneName,
                                SocketChannel channel)
Deprecated. 

Record that the user has logged in

Parameters:
zoneName - The zone name into which the user signed in
channel - The I/O channel on which the user is connected

login

public String login(String chapSeed,
                    String passwordGuess)
Validate the user's login attempt, returning a failure message if it could not happen (e.g. the user is kicked). Returns null if the user CAN log in. DOES NOT log the user in to SFS though!

Parameters:
chapSeed - The CHAP random seed (or null, if no seed was used)
passwordGuess - The guessed password. This should be an MD5sum if CHAP is being used (if the seed is not null), or the plaintext password otherwise
Returns:
an error string for the user, or null, if successful.

nameNeedsApproval

public boolean nameNeedsApproval()
Returns true if this user has requested a name but it hasn't yet been approved by a Lifeguard

Returns:
true, if user has requested a new name and it hasn't yet been approved

nameNeedsParentalApproval

public boolean nameNeedsParentalApproval()
Returns:
true if the name hasn't been approved by the parent yet

needsNaming

public boolean needsNaming()
Returns whether this account has a system-provided (not user-provided) name, or no name at all, and we need to prompt the user (or parent) to name it.

Returns:
true if this user needs to be named

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)

notifyFurnitureInventory

public void notifyFurnitureInventory(AbstractRoom room)
Specified by:
notifyFurnitureInventory in interface AbstractUser
Parameters:
room - WRITEME
See Also:
AbstractUser.notifyFurnitureInventory(org.starhope.appius.game.AbstractRoom)

parentApprovedAccount

public void parentApprovedAccount(boolean whether)
Call this method when the parent determines whether to approve or disapprove this account.

Parameters:
whether - the parent has approved the account; true = approved; false = disapproved

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.

populateByID

protected void populateByID(int id)
                     throws NotFoundException
Private method used to look up User in the database and fill in the attributes

Parameters:
id - The database ID to load
Throws:
NotFoundException - if the ID isn't found in the database.

populateByLogin

protected void populateByLogin(String loadLogin)
                        throws NotFoundException
Fetch a user record out of the database based upon its login name

Parameters:
loadLogin - The login name (user name)
Throws:
NotFoundException - if there is no user named that *right now*. (There may have been one in the past. Login names are maleable.)

postLoginGlobal

public void postLoginGlobal()
WRITEME: document this method (brpocock, Jan 8, 2010)


readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
XXX Java serialization stuff

Parameters:
in - WRITEME
Throws:
IOException - WRITEME
ClassNotFoundException - WRITEME

remindPassword

protected void remindPassword()
This is an overriding method. If this user is a staff member, resets their password.

Overrides:
remindPassword in class Person
See Also:
Person.remindPassword()

removeBuddy

public void removeBuddy(AbstractUser otherGuy)
Don't want for him to be my buddy any more

Specified by:
removeBuddy in interface AbstractUser
Parameters:
otherGuy - who?
See Also:
AbstractUser.removeBuddy(org.starhope.appius.user.AbstractUser)

rename

public void rename(String newName)

Rename the user account, updating all necessary related records. Note, in particular, that Smartfox is wholly dependant upon user names, so all records related to Smartfox must be updated!

If the user is currently online, this will fuck up hilariously, I think.

This is an overriding method.

Specified by:
rename in class Person
Parameters:
newName - The new user name
See Also:
Person.rename(java.lang.String)

reportedToModeratorBy

public void reportedToModeratorBy(AbstractUser u)
WRITEME: document this method (brpocock, Aug 31, 2009)

Specified by:
reportedToModeratorBy in interface AbstractUser
Parameters:
u - WRITEME

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

requestParentApproval

public void requestParentApproval()
request parent approval


sendConfirmationForPremium

public void sendConfirmationForPremium()
Send a confirmation eMail for a premium user.


sendEarnings

public void sendEarnings(AbstractRoom room,
                         String string)
Specified by:
sendEarnings in interface AbstractUser
Parameters:
room - WRITEME
string - WRITEME
See Also:
AbstractUser.sendEarnings(org.starhope.appius.game.AbstractRoom, java.lang.String)

sendGameAction

@Deprecated
public void sendGameAction(User from,
                                      org.json.JSONObject data)
                    throws org.json.JSONException
Deprecated. 

Send a game action to another user.

Parameters:
from - The user sending the game action (to this user)
data - The game action data
Throws:
org.json.JSONException - if the data can't be sent in JSON

sendMigrate

public void sendMigrate(AbstractZone refugeeZone)
                 throws UserDeadException
Send a notification to the user that s/he should reconnect to a different zone

Specified by:
sendMigrate in interface AbstractUser
Parameters:
refugeeZone - the zone to which the user should migrate
Throws:
UserDeadException - WRITEME

sendOops

public void sendOops()
Description copied from interface: AbstractUser
WRITEME

Specified by:
sendOops in interface AbstractUser
See Also:
AbstractUser.sendOops()

sendPrivateMessage

@Deprecated
public void sendPrivateMessage(AbstractUser from,
                                          String message)
Deprecated. 

Deprecated. See the more accurately-named acceptPrivateMessage(AbstractUser, String)

Parameters:
from - the user speaking
message - the words spoken
See Also:
acceptPrivateMessage(AbstractUser, String)

sendPublicMessage

@Deprecated
public void sendPublicMessage(User from,
                                         String speech)
Deprecated. use acceptPublicMessage(AbstractUser, String)

Accept a public message.

Parameters:
from - The user speaking
speech - the words spoken
See Also:
acceptPublicMessage(AbstractUser, String)

sendResponse

public void sendResponse(org.json.JSONObject result)
Specified by:
sendResponse in interface AbstractUser
Parameters:
result - WRITEME
See Also:
AbstractUser.sendResponse(org.json.JSONObject)

sendResponse

@Deprecated
public void sendResponse(org.json.JSONObject result,
                                    int room)
Deprecated. use sendResponse(JSONObject)

Send a response to this user's client, if one is connected.

Parameters:
result - the response datagram in JSON
room - the room from which the response is coming (or -1 for not-specified) (ignored)

sendSuccessReply

private void sendSuccessReply(String source,
                              org.json.JSONObject reply,
                              AbstractUser sender,
                              int room)
Send a “success” reply to the client if one is connected

Parameters:
source - The method returning success
reply - additional details of the success to be returned to the client
sender - the user reporting success
room - the room in which the success happened, or -1 if not specified

sendUserLists

public void sendUserLists()
Sends the user an asynchronous notification of their user lists' status. This is normally triggered by a change in the status of one of the users on these lists. (Note, User Lists are the buddy list and ignore list.)

Specified by:
sendUserLists in interface AbstractUser
See Also:
AbstractUser.sendUserLists()

sendWardrobe

public void sendWardrobe()
Specified by:
sendWardrobe in interface AbstractUser
See Also:
AbstractUser.sendWardrobe()

set

protected void set(ResultSet resultSet)
            throws SQLException
Specified by:
set in class SQLPeerDatum
Parameters:
resultSet - The result of an SQL query, with the cursor already pointed at the row describing this specific instance of the object.
Throws:
SQLException - if the database fails somehow
See Also:
SQLPeerDatum.set(java.sql.ResultSet)

setActive

public void setActive(boolean isActive1)
Parameters:
isActive1 - the isActive to set

setAgeGroup

public AgeBracket setAgeGroup()
Sets the age group based upon the user's date of birth.

Returns:
The age group computed for this user

setAgeGroupToSystem

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

Specified by:
setAgeGroupToSystem in interface AbstractUser

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)
Specified by:
setBaseColor in interface AbstractUser
Parameters:
newBaseColor - the baseColor to set

setBirthDate

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

setCanceled

public void setCanceled(boolean isCanceled1)
Parameters:
isCanceled1 - the isCanceled to set

setCanContact

public void setCanContact(boolean canContact1)
Overrides:
setCanContact in class Person
Parameters:
canContact1 - the canContact to set

setCanEnterChatZone

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

setCanEnterMenuZone

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

setCanTalk

public void setCanTalk(boolean canTalk1)
Specified by:
setCanTalk in interface AbstractUser
Parameters:
canTalk1 - the canTalk to set

setChatBG

public void setChatBG(Colour newChatBG)
Parameters:
newChatBG - the new chat background colour

setChatFG

public void setChatFG(Colour newChatFG)
Parameters:
newChatFG - the chat foreground colour to set

setEmailPlusDate

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

setExtraColor

public void setExtraColor(Colour extraColor1)
Specified by:
setExtraColor in interface AbstractUser
Parameters:
extraColor1 - the extraColor to set

setFacing

public void setFacing(String newFacing)
Parameters:
newFacing - the facing to set

setGivenName

public void setGivenName(String givenName1)
Overrides:
setGivenName in class Person
Parameters:
givenName1 - the givenName to set

setLastActive

public void setLastActive()
Description copied from interface: AbstractUser
WRITEME

Specified by:
setLastActive in interface AbstractUser

setLogin

public void setLogin(String ipAddress,
                     String zone)
Notify the multiverse that the user is logging in Set up the User records, indicating that the user has (in fact) logged in to the game. Record the IP address and Zone server.

Parameters:
ipAddress - The IP address (or something like it) from which the user has logged-in
zone - The active server zone into which the User has logged-in.

setMail

public void setMail(String newMail)
             throws GameLogicException
Specified by:
setMail in interface AbstractUser
Overrides:
setMail in class Person
Parameters:
newMail - the mail to set
Throws:
GameLogicException - if attempting to set an eMail address on a kid account

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.

Overrides:
setMailConfirmed in class Person
Parameters:
mailConfirmed1 - the date and time at which the user's mail was confirmed.

setNeedsNaming

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

setParent

public void setParent(Parent parent)
               throws GameLogicException,
                      ForbiddenUserException
Set this to be a child account with the specified parent.

Parameters:
parent - the parent to set
Throws:
GameLogicException - if this user is an adult
ForbiddenUserException - WRITEME

setParentByParent

public void setParentByParent(Parent parent)
                       throws GameLogicException
Set this to be a child account with the specified parent.

Parameters:
parent - the parent to set
Throws:
GameLogicException - if this user is an adult

setReferer

public void setReferer(String theReferer)
WRITEME: document this method (brpocock, Sep 22, 2009)

Parameters:
theReferer - WRITEME

setRegisteredAt

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

setRoom

public int setRoom(AbstractRoom room)
Set the user's current room to the given room. This will part from the prior room, if the user was in a room already. It also sets the user variable “d” to (-100,-100) coördinates.

Specified by:
setRoom in interface AbstractUser
Parameters:
room - the room in which the user must exist
Returns:
the room number set

setServerThread

public void setServerThread(AppiusClaudiusCaecus newThread)
Set the server thread controlling this user. Disconnect any pre-existing server thread.

Parameters:
newThread - The new server thread.

setStaffLevel

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

setStartT

public void setStartT(long when)
This is an overriding method.

Specified by:
setStartT in interface AbstractUser
Parameters:
when - WRITEME
See Also:
AbstractUser.setStartT(long)

setStructure

public void setStructure(org.starhope.appius.game.inventory.HomeDecorItem item)
Activate one structural element in lieu of any others that occupy the same slot.

Specified by:
setStructure in interface AbstractUser
Parameters:
item - WRITEME

setSubclassValues

protected void setSubclassValues(ResultSet resultSet)
                          throws SQLException
Set the values specific to a subclass of User

Parameters:
resultSet - WRITEME
Throws:
SQLException - WRITEME

setTargetX

public void setTargetX(double newTargetX)
Parameters:
newTargetX - the targetX to set

setTargetY

public void setTargetY(double newTargetY)
Parameters:
newTargetY - the targetY to set

setTravelRate

public void setTravelRate(double rate)
This is an overriding method.

Specified by:
setTravelRate in interface AbstractUser
Parameters:
rate - WRITEME
See Also:
AbstractUser.setTravelRate(double)

setUserName

public void setUserName(String newLogin)
                 throws AlreadyUsedException,
                        ForbiddenUserException
Parameters:
newLogin - the userName to set
Throws:
ForbiddenUserException - if the user name is not allowed
AlreadyUsedException - if the user name is in-use

setUserNameFromUser

public void setUserNameFromUser(String userRequestedLogin)
                         throws AlreadyUsedException,
                                ForbiddenUserException

Set a user name, requested by the user. (Sends to lifeguards for approval)

Clears needsNaming.

Parameters:
userRequestedLogin - the userName to set
Throws:
ForbiddenUserException - if the user name isn't allowed
AlreadyUsedException - if the user name has already been used (or requested)

setVariable

public void setVariable(Map.Entry<String,String> var)
This is an overriding method.

Specified by:
setVariable in interface HasVariables
Parameters:
var - A Hash type Entry object containing a key-value pair to be used to set a variable.
See Also:
HasVariables.setVariable(java.util.Map.Entry)

setVariable

public void setVariable(String varName,
                        String varValue)
WRITEME: document this method (brpocock, Oct 19, 2009)

Specified by:
setVariable in interface HasVariables
Specified by:
setVariable in interface AbstractUser
Parameters:
varName - WRITEME
varValue - WRITEME

setVariables

public void setVariables(Map<String,String> map)
This is an overriding method.

Specified by:
setVariables in interface HasVariables
Parameters:
map - WRITEME
See Also:
HasVariables.setVariables(java.util.Map)

setX

public void setX(double newX)
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Nov 24, 2009)

Specified by:
setX in interface AbstractUser
Parameters:
newX - the x to set

setY

public void setY(double newY)
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Nov 24, 2009)

Specified by:
setY in interface AbstractUser
Parameters:
newY - the y to set

speak

public void speak(AbstractRoom room,
                  String string)
Specified by:
speak in interface AbstractUser
Parameters:
room - WRITEME
string - WRITEME
See Also:
AbstractUser.speak(org.starhope.appius.game.AbstractRoom, java.lang.String)

startEnrolment

public abstract void startEnrolment(UserEnrolment userEnrolment)
Parameters:
userEnrolment - the enrolment to be started for this user

toJSONRef

public org.json.JSONObject toJSONRef()
This is analogous to toSFSXML() for the pure JSON “to infinity and beyond” interface

Returns:
the brief JSON record giving the user's name, ID, and variables.

toSFSXML

public String toSFSXML()
Description copied from interface: AbstractUser
TODO: document this method (brpocock, Oct 31, 2009)

Specified by:
toSFSXML in interface AbstractUser
Returns:
The User record in the sense of Smart Fox Server's XML format, as used in joinOK and uER (user enters room) messages

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

updateCache

public void updateCache()
Update the Whirley cache to know about this object.


wear

public void wear(org.starhope.appius.game.inventory.ClothingItem item)
Specified by:
wear in interface AbstractUser
Parameters:
item - The clothing item to be worn

wear

public void wear(org.starhope.appius.game.inventory.ClothingItem item,
                 Colour colour)
Put on a wearable item, to include Pivitz as well as clothing and so forth.

Specified by:
wear in interface AbstractUser
Parameters:
item - The item to be worn
colour - The color to set for the item. If the colour is not being overridden, set this to null.

wear

public void wear(org.starhope.appius.game.inventory.ClothingItem item,
                 int color)
WRITEME: document this method (brpocock, Jan 12, 2010)

Parameters:
item - WRITEME
color - WRITEME

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
This is an overriding method.

Throws:
IOException
See Also:
org.starhope.appius.via.ViaAppia#writeExternal(java.io.ObjectOutput)