Class OnePlayerArea
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.area.AreaEntity
games.stendhal.server.entity.mapstuff.area.OnePlayerArea
- All Implemented Interfaces:
MovementListener,Killer,Cloneable,Iterable<String>,Serializable
An area that only allows one play at a time to enter.
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WeakReference<Player>The reference to the entity currently in the area.Fields inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
ATTR_NAMEFields inherited from class marauroa.common.game.RPObject
INVALID_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeforeMove(ActiveEntity entity, StendhalRPZone zone, int oldX, int oldY, int newX, int newY) Invoked before an entity moves while over the object area.protected voidClear the occupant.protected booleanCheck if an entity is in this area.protected PlayerGet the occupant.booleanisObstacle(Entity entity) Checks whether players, NPC's, etc.voidonAdded(StendhalRPZone zone) Called when this object is added to a zone.voidonEntered(ActiveEntity entity, StendhalRPZone zone, int newX, int newY) Invoked when an entity enters the object area.voidonExited(ActiveEntity entity, StendhalRPZone zone, int oldX, int oldY) Invoked when an entity leaves the object area.voidonMoved(ActiveEntity entity, StendhalRPZone zone, int oldX, int oldY, int newX, int newY) Invoked when an entity moves while over the object area.voidonRemoved(StendhalRPZone zone) Called when this object is being removed from a zone.protected voidsetOccupant(Player player) Set the occupant.voidupdate()Handle object attribute change(s).Methods inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
addBehaviour, generateRPClass, getDescriptionName, getName, getTitle, setNameMethods inherited from class games.stendhal.server.entity.Entity
describe, getAdjacentNodes, getArea, getArea, getCursor, getDescription, getEntitySlot, getHeight, getOrigin, getResistance, getResistance, getWidth, getX, getY, getZone, hasDescription, isInSight, nextTo, nextTo, notifyWorldAboutChanges, 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, size, 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, spliteratorMethods inherited from interface games.stendhal.server.core.events.MovementListener
getArea
-
Field Details
-
occupantRef
The reference to the entity currently in the area.
-
-
Constructor Details
-
OnePlayerArea
public OnePlayerArea(int width, int height) Create a one player area.- Parameters:
width- The area width.height- The area height.
-
-
Method Details
-
clearOccupant
protected void clearOccupant()Clear the occupant. -
contains
Check if an entity is in this area.- Parameters:
entity- The entity to check.- Returns:
trueif the entity is in this area.
-
getOccupant
Get the occupant.- Returns:
- The area occupant, or
nullin none.
-
setOccupant
Set the occupant.- Parameters:
player- The occupant to set.
-
isObstacle
Checks whether players, NPC's, etc. can walk over this entity.- Overrides:
isObstaclein classEntity- Parameters:
entity- The entity trying to enter.- Returns:
trueif a Player is given and it is occupied by someone else.
-
onAdded
Called when this object is added to a zone.- Overrides:
onAddedin classAreaEntity- Parameters:
zone- The zone this was added to.
-
onRemoved
Called when this object is being removed from a zone.- Overrides:
onRemovedin classAreaEntity- Parameters:
zone- The zone this will be removed from.
-
update
public void update()Handle object attribute change(s). -
onEntered
Invoked when an entity enters the object area.- Specified by:
onEnteredin interfaceMovementListener- Parameters:
entity- The entity that moved.zone- The new zone.newX- The new X coordinate.newY- The new Y coordinate.
-
onExited
Invoked when an entity leaves the object area.- Specified by:
onExitedin interfaceMovementListener- Parameters:
entity- The entity that entered.zone- The old zone.oldX- The old X coordinate.oldY- The old Y coordinate.
-
onMoved
public void onMoved(ActiveEntity entity, StendhalRPZone zone, int oldX, int oldY, int newX, int newY) Invoked when an entity moves while over the object area.- Specified by:
onMovedin interfaceMovementListener- Parameters:
entity- The entity that left.zone- The zone.oldX- The old X coordinate.oldY- The old Y coordinate.newX- The new X coordinate.newY- The new Y coordinate.
-
beforeMove
public void beforeMove(ActiveEntity entity, StendhalRPZone zone, int oldX, int oldY, int newX, int newY) Description copied from interface:MovementListenerInvoked before an entity moves while over the object area.- Specified by:
beforeMovein interfaceMovementListener- Parameters:
entity- The entity that left.zone- The zone.oldX- The old X coordinate.oldY- The old Y coordinate.newX- The new X coordinate.newY- The new Y coordinate.
-