Class PersonalChest
java.lang.Object
marauroa.common.game.Attributes
marauroa.common.game.SlotOwner
marauroa.common.game.RPObject
games.stendhal.server.entity.Entity
games.stendhal.server.entity.mapstuff.chest.Chest
games.stendhal.server.entity.mapstuff.chest.PersonalChest
- All Implemented Interfaces:
UseListener
,Killer
,Cloneable
,Iterable<String>
,Serializable
A PersonalChest is a Chest that can be used by everyone, but shows different
contents depending on the player who is currently using it. Thus, a player
can put in items into this chest and be sure that nobody else will be able to
take them out.
Caution: each PersonalChest must be placed in such a way that only one player can stand next to it at a time, to prevent other players from stealing while the owner is looking at his items.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
A listener for syncing the slot contents.Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
ConstructorDescriptionCreate a personal chest using the default bank slot.PersonalChest(String bankName)
Create a personal chest using a specific bank slot. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the chest.Gets the entitiy which is currently served by this chest.Get the slot that holds items for this chest.getDescriptionName(boolean definite)
Returns the name or something that can be used to identify the entity for the player.void
onRemoved(StendhalRPZone zone)
Called when this object is being removed from a zone.boolean
Invoked when the object is used.void
open()
Don't let this be called directly for personal chests.void
Open the chest for an attending user.protected boolean
Sync the slot contents.Methods inherited from class games.stendhal.server.entity.mapstuff.chest.Chest
add, describe, generateRPClass, getContent, isOpen, size, update
Methods inherited from class games.stendhal.server.entity.Entity
getAdjacentNodes, getArea, getArea, getCursor, getDescription, getEntitySlot, getHeight, getName, getOrigin, getResistance, getResistance, getTitle, getWidth, getX, getY, getZone, hasDescription, isInSight, isObstacle, nextTo, nextTo, notifyWorldAboutChanges, onAdded, onMoved, setCursor, setDescription, setEntityClass, setEntitySubclass, setMenu, setPosition, setResistance, setSize, setVisibility, slotIterator, slots, squaredDistance, squaredDistance, stopped
Methods inherited from class marauroa.common.game.RPObject
addEvent, addLink, addLink, addMap, addSlot, addSlot, applyDifferences, clearEvents, clearVisible, clone, containsKey, equals, events, eventsIterator, fill, get, getBaseContainer, getBoolean, getContainer, getContainerBaseOwner, getContainerOwner, getContainerSlot, getDifferences, getDouble, getFromSlots, getID, getInt, getLink, getLinkedObject, getMap, getSlot, has, hashCode, hasLink, hasMap, hasSlot, hide, isContained, isEmpty, isHidden, isStorable, maps, put, put, put, put, readObject, remove, removeLink, removeMap, removeSlot, resetAddedAndDeleted, resetAddedAndDeletedMaps, resetAddedAndDeletedRPLink, resetAddedAndDeletedRPSlot, setAddedMaps, setAddedRPSlot, setContainer, setDeletedMaps, setDeletedRPSlot, setID, slots, slotsIterator, store, toString, unhide, unstore, writeObject, writeObject, writeToJson
Methods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlots
Methods inherited from class marauroa.common.game.Attributes
add, applyDifferences, get, getBool, getDouble, getInt, getList, getLong, getRPClass, has, instanceOf, iterator, put, put, put, put, put, readFromMap, remove, resetAddedAndDeletedAttributes, setAddedAttributes, setDeletedAttributes, setRPClass, setRPClass, toAttributeString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
DEFAULT_BANK
The default bank slot name.- See Also:
- Constant Field Values
-
-
Constructor Details
-
PersonalChest
public PersonalChest()Create a personal chest using the default bank slot. -
PersonalChest
Create a personal chest using a specific bank slot.- Parameters:
bankName
- The name of the bank slot.
-
-
Method Details
-
getAttending
Gets the entitiy which is currently served by this chest.- Returns:
- Entity
-
getBankSlot
Get the slot that holds items for this chest.- Returns:
- A per-player/per-bank slot.
-
syncContent
protected boolean syncContent()Sync the slot contents.- Returns:
true
if it should be called again.
-
open
Open the chest for an attending user.- Parameters:
user
- The attending user.
-
close
public void close()Close the chest. -
open
public void open()Don't let this be called directly for personal chests. -
onUsed
Description copied from interface:UseListener
Invoked when the object is used.- Specified by:
onUsed
in interfaceUseListener
- Overrides:
onUsed
in classChest
- Parameters:
user
- the RPEntity who uses the object- Returns:
- true if successful
-
getDescriptionName
Description copied from class:Entity
Returns the name or something that can be used to identify the entity for the player.- Overrides:
getDescriptionName
in classChest
- Parameters:
definite
- true for "the" and false for "a/an" in case the entity has no name- Returns:
- name
-
onRemoved
Description copied from class:Entity
Called when this object is being removed from a zone.
-