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
ConstructorDescriptionGate()
Create a new vertical gate.Gate(String orientation, String image, ChatCondition condition)
Create a new gate. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the gate.static void
Get the identifier of the gateRetrieve message to be sent when access is refused.protected boolean
Check if a player can use the gate.boolean
isOpen()
Check if the gate is open.void
onTurnReached(int currentTurn)
Callback for the turn notifier to automatically close the gate if the interval is setboolean
Invoked when the object is used.void
open()
Open the gate.void
invoked when the expressions of a PuzzleBuildingBlock have been updated.void
setAutoCloseDelay(int seconds)
Make the gate close automatically after specified delay once it's been opened.void
setIdentifier(String id)
Sets this gate's identifierprotected void
setOpen(boolean open)
Set the door open or closed.void
setPuzzleBuildingBlock(PuzzleBuildingBlock buildingBlock)
sets the PuzzleBuildingBlockvoid
setRefuseMessage(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, update
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, size, 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
-
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, ornull
if 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:UseListener
Invoked when the object is used.- Specified by:
onUsed
in 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:
true
iff 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:
onTurnReached
in interfaceTurnListener
- Parameters:
currentTurn
- current turn number
-
puzzleExpressionsUpdated
public void puzzleExpressionsUpdated()Description copied from interface:PuzzleEntity
invoked when the expressions of a PuzzleBuildingBlock have been updated. It is ensured that there was an actual change.- Specified by:
puzzleExpressionsUpdated
in interfacePuzzleEntity
-
setPuzzleBuildingBlock
Description copied from interface:PuzzleEntity
sets the PuzzleBuildingBlock- Specified by:
setPuzzleBuildingBlock
in interfacePuzzleEntity
- Parameters:
buildingBlock
- PuzzleBuildingBlock
-