All Packages Class Hierarchy This Package Previous Next Index
Class key.Player
java.lang.Object
|
+----key.Atom
|
+----key.Container
|
+----key.AnimatedContainer
|
+----key.Player
- public final class Player
- extends AnimatedContainer
- implements LatentlyCached, Targetable, CommandContainer
This is the main instance of a player on the program
-
commandList
- Commands that are specific for this particular
atom.
-
DEFAULT_MAX_FRIENDS
-
-
DEFAULT_MAX_INFORM
-
-
DEFAULT_MAX_MAIL
-
-
DEFAULT_MAX_OBJECTS
-
-
DEFAULT_MAX_PREFER
-
-
discard
-
-
FAIL_PASSWORD_LOG
-
-
findAction
-
-
friendAction
-
-
lagAmount
-
-
lagOnce
-
-
MAX_IDLE_TICKS
-
-
MAX_NAME
-
-
MIN_NAME
-
-
seePrivateInfoAction
-
-
SHOWCHARS
-
-
SHOWFLAG_DIRECTED
-
-
SHOWFLAG_ENTER
-
-
SHOWFLAG_FRIENDS
-
-
SHOWFLAG_LEAVE
-
-
SHOWFLAG_LOGIN
-
-
SHOWFLAG_LOGOUT
-
-
SHOWFLAG_ROOM
-
-
SHOWFLAG_SHOUTS
-
-
SHOWNAMES
-
-
staticActions
-
-
staticCommandList
- This is a reference to some sort of 'standard'
command list for this _type_ of atom.
-
summonAction
-
-
tellAction
-
-
Player()
- Constructs a player
-
addGenderProperty(String, int)
- Adds a new gender property to the player.
-
addMail(Letter)
-
-
afk(boolean)
-
-
aspect()
- A players aspect is its description when looked at
-
assignInitialOwner()
- Players always own themselves
-
authenticate(InteractiveConnection)
- Called when a password entry is required
-
beginConnect()
-
-
brief()
-
-
canMakeFriend(Player)
-
-
canSave()
-
-
canSwap()
-
-
command(String, InteractiveConnection)
- This routine kind of doubles up with ModalCommand,
but searches many more places than ModalCommand
does.
-
connected()
- true if the player is connected
-
connectTo(InteractiveConnection)
- Called to connect a player to an interactive connection.
-
containsAction(Action)
- Returns true if the action is supported by
this class.
-
countRooms()
- Returns the number of rooms the player has
-
deallocate()
-
-
disconnect()
- Called to terminate a players connection.
-
dispose()
- This is a method that should be called only once.
-
endConnect()
-
-
enrolIntoClan(Clan)
-
-
evalReadOnlyProperty(ReadOnlyProperty)
- override to return the correct value for the supplied property
make sure you call super.evalReadOnlyProperty if you don't
understand it before returning null
-
finalize()
-
-
findCommand(CommandContainer, String)
-
-
getAction(String)
- Returns the action corresponding to the
supplied name.
-
getActions()
- Returns a list of the actions supported by
this class.
-
getBlockingMsg()
-
-
getBlockMsg()
-
-
getClan()
-
-
getCodes()
-
-
getCommandList()
- A shortcut, since matching it from the
string could be prohibitively slow
-
getConnection()
-
-
getContext()
- Returns the current players context
-
getCookie(Atom)
-
-
getExpert()
-
-
getFriends()
-
-
getFullName()
-
-
getHome()
-
-
getId()
-
-
getIdle(DateTime)
-
-
getIdleMsg()
-
-
getInform()
-
-
getLastPublicRoom()
-
-
getLocation()
- Gets the players location
-
getPossessiveName()
- eg: "subtle's"
-
getPrefer()
-
-
getQualifierList()
-
-
getRank()
-
-
getRepeated()
-
-
getShowFlags()
-
-
getStaticCommandList()
- A shortcut, since matching it from the
string could be prohibitively slow
-
getTerminal()
-
-
getTimezone()
-
-
getTitledName()
-
-
getTotalPlayers()
-
-
giveFlorins(int)
- Transaction based checking here would ensure that
the system couldn't be cheated, given that it was
a read only property, which it isn't.
-
hasPassword()
-
-
HeShe()
-
-
heShe()
-
-
himHer()
-
-
HisHer()
-
-
hisHer()
-
-
isAfk()
-
-
isBanished()
-
-
isBeyond()
-
-
isCitizen()
-
-
isHiding()
-
-
isIdle()
-
-
isLiberated()
- if the player can't be put into a clan
-
isOutRankedBy(Rank)
- You can target a player if you can target
any of the ranks that they're in.
-
isOwner(Atom)
- I hereby declare each player to be
a soverign state, owned by no
other.
-
isStaff()
-
-
linkToScape(Scape)
-
-
loadFrom(DataInput)
-
-
located()
- true if the player has a location
-
maleFemale()
-
-
maybeSetBeyond()
-
-
modified()
-
-
moveTo(Room)
-
-
moveTo(Room, Effect, Effect)
-
-
putCode(Character, String)
-
-
ranks()
-
-
recalculateIdlePrompt()
-
-
recieveFlorins(int)
-
-
resetModify()
-
-
resetTerminal()
-
-
roomLook()
-
-
run()
- The main thread of a player - simply starts the parser
-
scapes()
-
-
sendError(String)
- This function is used when the user makes some
sort of error in typing - *not* if a command
can't be executed because of a failure.
-
sendFailure(String)
-
-
sendFeedback(String)
- This function is used to output direct,
*successful* feedback of a players command.
-
sendSystem(String)
-
-
sendText(String)
- Meant to be used to send part of what would
normally be a paragraph.
-
setCanPage(boolean)
-
-
setContext(Atom)
-
-
setCookie(Atom, Object)
-
-
setGender(Gender)
-
-
setHome(Room)
-
-
setLag(int, boolean)
-
-
setPassword(String)
-
-
setSaved()
-
-
setTerminal(String)
-
-
splash(Effect, SuppressionList)
- When an effect occurs, people within its
"splash" range are notified (that is, they
can choose to notice or ignore it).
-
swapout()
- Similar to dispose(), the swapout() method prepares a
Atom to be swapped out non-destructively
You should probably sync() before doing this...
-
sync()
-
-
unIdle()
- Called by the interactive connection to reset the players idletime to 0
-
unlinkFromScape(Scape)
-
-
willSync()
-
-
writeTo(DataOutput)
-
FAIL_PASSWORD_LOG
public static final String FAIL_PASSWORD_LOG
DEFAULT_MAX_OBJECTS
public static final int DEFAULT_MAX_OBJECTS
DEFAULT_MAX_MAIL
public static final int DEFAULT_MAX_MAIL
DEFAULT_MAX_FRIENDS
public static final int DEFAULT_MAX_FRIENDS
DEFAULT_MAX_PREFER
public static final int DEFAULT_MAX_PREFER
DEFAULT_MAX_INFORM
public static final int DEFAULT_MAX_INFORM
MAX_NAME
public static final int MAX_NAME
MIN_NAME
public static final int MIN_NAME
SHOWFLAG_DIRECTED
public static final int SHOWFLAG_DIRECTED
SHOWFLAG_FRIENDS
public static final int SHOWFLAG_FRIENDS
SHOWFLAG_ROOM
public static final int SHOWFLAG_ROOM
SHOWFLAG_SHOUTS
public static final int SHOWFLAG_SHOUTS
SHOWFLAG_ENTER
public static final int SHOWFLAG_ENTER
SHOWFLAG_LEAVE
public static final int SHOWFLAG_LEAVE
SHOWFLAG_LOGIN
public static final int SHOWFLAG_LOGIN
SHOWFLAG_LOGOUT
public static final int SHOWFLAG_LOGOUT
SHOWCHARS
public static final char SHOWCHARS[]
SHOWNAMES
public static final String SHOWNAMES[]
commandList
protected AtomicProperty commandList
- Commands that are specific for this particular
atom. Examples might be custom commands in
rooms, such as 'look' (if its overridden to
give different messages each time you type
it)
staticCommandList
protected ReferenceProperty staticCommandList
- This is a reference to some sort of 'standard'
command list for this _type_ of atom. It
will generally be set when the atom is created
or loaded, and left to its own devices after
that.
MAX_IDLE_TICKS
public static final int MAX_IDLE_TICKS
lagAmount
protected int lagAmount
lagOnce
protected boolean lagOnce
discard
protected boolean discard
staticActions
protected static StringKeyCollection staticActions
tellAction
public static Action tellAction
findAction
public static Action findAction
friendAction
public static Action friendAction
summonAction
public static Action summonAction
seePrivateInfoAction
public static Action seePrivateInfoAction
Player
public Player()
- Constructs a player
assignInitialOwner
protected void assignInitialOwner()
- Players always own themselves
- Overrides:
- assignInitialOwner in class Atom
putCode
public final void putCode(Character c,
String value)
getCodes
public final Hashtable getCodes()
brief
public boolean brief()
isBeyond
public boolean isBeyond()
setTerminal
public synchronized boolean setTerminal(String name)
resetTerminal
public synchronized void resetTerminal()
getTerminal
public Terminal getTerminal()
getRepeated
public Repeated getRepeated()
addMail
public void addMail(Letter l) throws NonUniqueKeyException, BadKeyException
getQualifierList
public QualifierList getQualifierList()
getClan
public final Clan getClan()
setCanPage
public void setCanPage(boolean v)
getIdleMsg
public String getIdleMsg()
getBlockMsg
public String getBlockMsg()
getBlockingMsg
public String getBlockingMsg()
isCitizen
public final boolean isCitizen()
getExpert
public final boolean getExpert()
getTimezone
public final Duration getTimezone()
isHiding
public boolean isHiding()
isLiberated
public boolean isLiberated()
- if the player can't be put into a clan
getLastPublicRoom
public Room getLastPublicRoom()
getHome
public Room getHome()
setHome
public void setHome(Room r)
getFriends
public Friends getFriends()
getPrefer
public Group getPrefer()
getInform
public InformList getInform()
setPassword
public void setPassword(String newValue)
linkToScape
public void linkToScape(Scape s)
unlinkFromScape
public void unlinkFromScape(Scape s)
scapes
public Enumeration scapes()
ranks
public Enumeration ranks()
isOutRankedBy
public boolean isOutRankedBy(Rank rank)
- You can target a player if you can target
any of the ranks that they're in. That means
that most staff members will _not_ be in the
'resident' rank (so they can't hurt each other.
getPossessiveName
public final String getPossessiveName()
- eg: "subtle's"
getLocation
public final Room getLocation()
- Gets the players location
modified
public boolean modified()
resetModify
public void resetModify()
deallocate
public void deallocate()
unIdle
public final void unIdle()
- Called by the interactive connection to reset the players idletime to 0
getIdle
public final Duration getIdle(DateTime now)
aspect
public Paragraph aspect()
- A players aspect is its description when looked at
- Overrides:
- aspect in class Atom
authenticate
public boolean authenticate(InteractiveConnection ic) throws IOException, PlayerDoesntWantThisNameException
- Called when a password entry is required
beginConnect
public void beginConnect()
endConnect
public void endConnect()
setContext
public void setContext(Atom r)
getContext
public Atom getContext()
- Returns the current players context
setLag
public void setLag(int amount,
boolean continual)
run
public void run()
- The main thread of a player - simply starts the parser
- Overrides:
- run in class AnimatedContainer
recalculateIdlePrompt
public final void recalculateIdlePrompt()
isIdle
public final boolean isIdle()
afk
public final void afk(boolean v)
isAfk
public final boolean isAfk()
findCommand
public Object findCommand(CommandContainer search,
String command)
command
public void command(String fullLine,
InteractiveConnection ic)
- This routine kind of doubles up with ModalCommand,
but searches many more places than ModalCommand
does. Searches the current context + others
connected
public boolean connected()
- true if the player is connected
getConnection
public InteractiveConnection getConnection()
located
public boolean located()
- true if the player has a location
connectTo
public synchronized void connectTo(InteractiveConnection connection) throws NonUniqueKeyException, BadKeyException
- Called to connect a player to an interactive connection.
- splashes everyone on the program, letting them know this person
has connected.
- tells the Key object to link this player into the online players
- locks this players soul into memory
- updates the players statistics (tells the loginStatistics to begin
- tells the interactive connection which player to unidle (this) when
a command is entered.
dispose
public void dispose()
- This is a method that should be called only once.
- Overrides:
- dispose in class Container
swapout
public void swapout()
- Similar to dispose(), the swapout() method prepares a
Atom to be swapped out non-destructively
You should probably sync() before doing this...
- Overrides:
- swapout in class Container
disconnect
public synchronized void disconnect()
- Called to terminate a players connection.
- stops time recording
- takes the player out of the room that they're in
- removes the player from the online list of players in Key
- splashes everyone that the player is disconnecting
- closese the interactive connection
- stops the thread
setSaved
public void setSaved()
willSync
public boolean willSync()
hasPassword
public boolean hasPassword()
canSave
public boolean canSave()
isStaff
public boolean isStaff()
getRank
public String getRank()
sync
public void sync() throws IOException
- Overrides:
- sync in class Atom
moveTo
public void moveTo(Room newLocation,
Effect leave,
Effect enter)
roomLook
public void roomLook()
moveTo
protected void moveTo(Room newLocation)
giveFlorins
public void giveFlorins(int amount)
- Transaction based checking here would ensure that
the system couldn't be cheated, given that it was
a read only property, which it isn't.
getShowFlags
public boolean[] getShowFlags()
himHer
public final String himHer()
HisHer
public final String HisHer()
hisHer
public final String hisHer()
HeShe
public final String HeShe()
heShe
public final String heShe()
maleFemale
public final String maleFemale()
setGender
public final void setGender(Gender ng)
enrolIntoClan
public synchronized void enrolIntoClan(Clan newClan)
recieveFlorins
public void recieveFlorins(int amount)
canMakeFriend
public boolean canMakeFriend(Player p)
getTitledName
public String getTitledName()
getFullName
public String getFullName()
evalReadOnlyProperty
public Object evalReadOnlyProperty(ReadOnlyProperty p)
- override to return the correct value for the supplied property
make sure you call super.evalReadOnlyProperty if you don't
understand it before returning null
- Overrides:
- evalReadOnlyProperty in class Container
loadFrom
public synchronized void loadFrom(DataInput from) throws IOException
- Overrides:
- loadFrom in class Container
writeTo
public synchronized void writeTo(DataOutput to) throws IOException
- Overrides:
- writeTo in class Container
getId
public String getId()
- Overrides:
- getId in class Atom
isOwner
public boolean isOwner(Atom potential)
- I hereby declare each player to be
a soverign state, owned by no
other. ;p~
- Overrides:
- isOwner in class Atom
addGenderProperty
protected DataProperty addGenderProperty(String name,
int value)
- Adds a new gender property to the player. Probably
best if the player only has one ;). Value should
be one of: Gender.MALE, Gender.FEMALE or Gender.NEUTER
splash
public void splash(Effect e,
SuppressionList s)
- When an effect occurs, people within its
"splash" range are notified (that is, they
can choose to notice or ignore it).
- Overrides:
- splash in class Atom
sendSystem
public void sendSystem(String message)
sendFeedback
public void sendFeedback(String message)
- This function is used to output direct,
*successful* feedback of a players command.
It is important that this feedback is normal
and expected by the player, since it generally
won't be hilited in any way. Please try
to restrict this output to a single line.
this command does start a new line
Examples:
You tell name 'hi'
- Parameters:
- message - the text to be displayed
sendError
public void sendError(String message)
- This function is used when the user makes some
sort of error in typing - *not* if a command
can't be executed because of a failure. So,
Command not found would go here, but 'Not enough
privs to nuke snapper' wouldn't.
this command does start a new line
sendFailure
public void sendFailure(String message)
sendText
public void sendText(String message)
- Meant to be used to send part of what would
normally be a paragraph.
maybeSetBeyond
public final void maybeSetBeyond()
countRooms
public final int countRooms()
- Returns the number of rooms the player has
getCommandList
public final CommandList getCommandList()
- A shortcut, since matching it from the
string could be prohibitively slow
getStaticCommandList
public final CommandList getStaticCommandList()
- A shortcut, since matching it from the
string could be prohibitively slow
getActions
public Enumeration getActions()
- Returns a list of the actions supported by
this class.
- Overrides:
- getActions in class Container
containsAction
public boolean containsAction(Action a)
- Returns true if the action is supported by
this class.
- Overrides:
- containsAction in class Container
getAction
public Action getAction(String name)
- Returns the action corresponding to the
supplied name. This routine will need to
be overriden by sub-classes using actions.
- Overrides:
- getAction in class Container
getTotalPlayers
public static int getTotalPlayers()
finalize
protected void finalize() throws Throwable
- Overrides:
- finalize in class Container
canSwap
public boolean canSwap()
- Overrides:
- canSwap in class AnimatedContainer
isBanished
public boolean isBanished()
setCookie
public void setCookie(Atom key,
Object value)
getCookie
public Object getCookie(Atom key)
All Packages Class Hierarchy This Package Previous Next Index