Package games.stendhal.client
Class UserContext
java.lang.Object
games.stendhal.client.UserContext
- All Implemented Interfaces:
RPObjectChangeListener
The player user context. This class holds/manages the data for the user of
this client. This is independent of any on-screen representation Entity that,
while related, serves an entirely different purpose.
Currently this is just a helper class for StendhalClient. Maybe it will be
directly used by other code later.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a feature change listener.static UserContext
get()
int
Get the admin level.getName()
Get the player character name.int
Get the player's owned sheep RPObject ID.boolean
hasFeature(String name)
Checks if the player has a feature.boolean
isAdmin()
Determine if the user is an admin.void
An object was added.void
onChangedAdded(RPObject object, RPObject changes)
The object added/changed attribute(s).void
onChangedRemoved(RPObject object, RPObject changes)
An object removed attribute(s).void
An object was removed.void
onSlotAdded(RPObject object, String slotName, RPObject sobject)
A slot object was added.void
onSlotChangedAdded(RPObject object, String slotName, RPObject sobject, RPObject schanges)
A slot object added/changed attribute(s).void
onSlotChangedRemoved(RPObject object, String slotName, RPObject sobject, RPObject schanges)
A slot object removed attribute(s).void
onSlotRemoved(RPObject object, String slotName, RPObject sobject)
A slot object was removed.void
protected void
-
Method Details
-
get
-
addFeatureChangeListener
Add a feature change listener.- Parameters:
l
- The listener.
-
getAdminLevel
public int getAdminLevel()Get the admin level.- Returns:
- The admin level.
-
getName
Get the player character name.- Returns:
- The player character name.
-
getSheepID
public int getSheepID()Get the player's owned sheep RPObject ID.- Returns:
- The RPObject ID of the sheep the player owns, or
0
if none.
-
isAdmin
public boolean isAdmin()Determine if the user is an admin.- Returns:
true
is the user is an admin.
-
getPlayer
-
setPlayer
-
onAdded
An object was added.- Specified by:
onAdded
in interfaceRPObjectChangeListener
- Parameters:
object
- The object.
-
onChangedAdded
The object added/changed attribute(s).- Specified by:
onChangedAdded
in interfaceRPObjectChangeListener
- Parameters:
object
- The base object.changes
- The changes.
-
onChangedRemoved
An object removed attribute(s).- Specified by:
onChangedRemoved
in interfaceRPObjectChangeListener
- Parameters:
object
- The base object.changes
- The changes.
-
onRemoved
An object was removed.- Specified by:
onRemoved
in interfaceRPObjectChangeListener
- Parameters:
object
- The object.
-
onSlotAdded
A slot object was added.- Specified by:
onSlotAdded
in interfaceRPObjectChangeListener
- Parameters:
object
- The container object.slotName
- The slot name.sobject
- The slot object.
-
onSlotChangedAdded
public void onSlotChangedAdded(RPObject object, String slotName, RPObject sobject, RPObject schanges)A slot object added/changed attribute(s).- Specified by:
onSlotChangedAdded
in interfaceRPObjectChangeListener
- Parameters:
object
- The base container object.slotName
- The container's slot name.sobject
- The slot object.schanges
- The slot object changes.
-
onSlotChangedRemoved
public void onSlotChangedRemoved(RPObject object, String slotName, RPObject sobject, RPObject schanges)A slot object removed attribute(s).- Specified by:
onSlotChangedRemoved
in interfaceRPObjectChangeListener
- Parameters:
object
- The base container object.slotName
- The container's slot name.sobject
- The slot object.schanges
- The slot object changes.
-
onSlotRemoved
A slot object was removed.- Specified by:
onSlotRemoved
in interfaceRPObjectChangeListener
- Parameters:
object
- The container object.slotName
- The slot name.sobject
- The slot object.
-
setName
-
hasFeature
Checks if the player has a feature.
-