Class Gate
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.portal.Gate
- All Implemented Interfaces:
TurnListener,UseListener,Killer,PuzzleEntity,Cloneable,Iterable<String>,Serializable
-
Nested Class Summary
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
ConstructorsConstructorDescriptionGate()Create a new vertical gate.Gate(String orientation, String image, ChatCondition condition) Create a new gate. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the gate.static voidGet the identifier of the gateRetrieve message to be sent when access is refused.protected booleanCheck if a player can use the gate.booleanisOpen()Check if the gate is open.voidonTurnReached(int currentTurn) Callback for the turn notifier to automatically close the gate if the interval is setbooleanInvoked when the object is used.voidopen()Open the gate.voidinvoked when the expressions of a PuzzleBuildingBlock have been updated.voidsetAutoCloseDelay(int seconds) Make the gate close automatically after specified delay once it's been opened.voidsetIdentifier(String id) Sets this gate's identifierprotected voidsetOpen(boolean open) Set the door open or closed.voidsetPuzzleBuildingBlock(PuzzleBuildingBlock buildingBlock) sets the PuzzleBuildingBlockvoidsetRefuseMessage(String message) Set the message to be send to the player if she's not allowed to open the gateMethods inherited from class games.stendhal.server.entity.Entity
describe, generateRPClass, getAdjacentNodes, getArea, getArea, getCursor, getDescription, getDescriptionName, getEntitySlot, getHeight, getName, getOrigin, getResistance, getResistance, getTitle, getWidth, getX, getY, getZone, hasDescription, isInSight, isObstacle, nextTo, nextTo, notifyWorldAboutChanges, onAdded, onMoved, onRemoved, setCursor, setDescription, setEntityClass, setEntitySubclass, setMenu, setPosition, setResistance, setSize, setVisibility, slotIterator, slots, squaredDistance, squaredDistance, stopped, updateMethods 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, spliterator
-
Constructor Details
-
Gate
Create a new gate.- Parameters:
orientation- gate orientation. Either "v" or "h".image- image used for the gatecondition- conditions required for opening the gate, ornullif no checking is required
-
Gate
public Gate()Create a new vertical gate.
-
-
Method Details
-
generateGateRPClass
public static void generateGateRPClass() -
open
public void open()Open the gate. -
isOpen
public boolean isOpen()Check if the gate is open.- Returns:
- true iff the gate is open
-
close
public void close()Close the gate. -
onUsed
Description copied from interface:UseListenerInvoked when the object is used.- Specified by:
onUsedin interfaceUseListener- Parameters:
user- the RPEntity who uses the object- Returns:
- true if successful
-
setAutoCloseDelay
public void setAutoCloseDelay(int seconds) Make the gate close automatically after specified delay once it's been opened.- Parameters:
seconds- time to keep the gate open
-
isAllowed
Check if a player can use the gate.- Parameters:
user- player trying to close or open the gate- Returns:
trueiff the player is allowed to use the gate
-
setOpen
protected void setOpen(boolean open) Set the door open or closed.- Parameters:
open- true if the door is opened, false otherwise
-
getIdentifier
Get the identifier of the gate- Returns:
- the gate's identifier
-
setIdentifier
Sets this gate's identifier- Parameters:
id- the new identifier of the gate
-
setRefuseMessage
Set the message to be send to the player if she's not allowed to open the gate- Parameters:
message-
-
getRefuseMessage
Retrieve message to be sent when access is refused. -
onTurnReached
public void onTurnReached(int currentTurn) Callback for the turn notifier to automatically close the gate if the interval is set- Specified by:
onTurnReachedin interfaceTurnListener- Parameters:
currentTurn- current turn number
-
puzzleExpressionsUpdated
public void puzzleExpressionsUpdated()Description copied from interface:PuzzleEntityinvoked when the expressions of a PuzzleBuildingBlock have been updated. It is ensured that there was an actual change.- Specified by:
puzzleExpressionsUpdatedin interfacePuzzleEntity
-
setPuzzleBuildingBlock
Description copied from interface:PuzzleEntitysets the PuzzleBuildingBlock- Specified by:
setPuzzleBuildingBlockin interfacePuzzleEntity- Parameters:
buildingBlock- PuzzleBuildingBlock
-