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
Nested ClassesModifier and TypeClassDescriptionprotected classA listener for syncing the slot contents.Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID -
Field Summary
FieldsFields inherited from class marauroa.common.game.RPObject
INVALID_ID -
Constructor Summary
ConstructorsConstructorDescriptionCreate a personal chest using the default bank slot.PersonalChest(String bankName) Create a personal chest using a specific bank slot. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.voidonRemoved(StendhalRPZone zone) Called when this object is being removed from a zone.booleanInvoked when the object is used.voidopen()Don't let this be called directly for personal chests.voidOpen the chest for an attending user.protected booleanSync the slot contents.Methods inherited from class games.stendhal.server.entity.mapstuff.chest.Chest
add, describe, generateRPClass, getContent, isOpen, size, updateMethods 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, stoppedMethods 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, writeToJsonMethods inherited from class marauroa.common.game.SlotOwner
deserializeRPSlots, fill, serializeRPSlotsMethods 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, toAttributeStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
DEFAULT_BANK
The default bank slot name.- See Also:
-
-
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:
trueif 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:UseListenerInvoked when the object is used.- Specified by:
onUsedin interfaceUseListener- Overrides:
onUsedin classChest- Parameters:
user- the RPEntity who uses the object- Returns:
- true if successful
-
getDescriptionName
Description copied from class:EntityReturns the name or something that can be used to identify the entity for the player.- Overrides:
getDescriptionNamein 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:EntityCalled when this object is being removed from a zone.
-