Class Portal
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.Portal
- All Implemented Interfaces:
UseListener
,Killer
,Cloneable
,Iterable<String>
,Serializable
- Direct Known Subclasses:
ConditionAndActionPortal
,Door
,HousePortal
,KeyedPortal
,LevelCheckingPortal
,OneWayPortalDestination
,PasswordPortal
,QuestCheckingPortal
,QuestCompletedPortal
,Teleporter
A portal which teleports the player to another portal if used.
-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Modifier and TypeFieldDescriptionprotected static String
Attribute for player face direction.protected static String
The hidden flags attribute name.protected static String
Attribute for player positioning.protected static String
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Get the direction player should face when portal is used as a destination.gets the identifier of this portal.int
Gets offset positioning value when used as a destination.boolean
Check if the portal has defined a direction for player to face when portal is used as a destination.boolean
Checks if portal has an offset positioning when used as a destination.boolean
isHidden()
Determine if this portal is hidden from players.boolean
loaded()
void
logic()
void
onPushedOntoFrom(RPEntity pushed, RPEntity pusher, Point prevPos)
Sub-classes can override for actions to be taken if entity was pushed onto portal.boolean
Invoked when the object is used.void
onUsedBackwards(RPEntity user, boolean hadPath)
If this portal is the destination of another portal used.void
setDestination(String zone, Object reference)
Set the destination portal zone and reference.void
setFaceDirection(Direction dir)
Sets the direction attribute for the portal which determines the direction the player should face when this portal is used as a destination.void
setFaceDirection(String dir)
Setup direction player should face after using portal as a destination.void
setHidden(boolean hide)
Sets or removes the "hidden" attribute.void
setIdentifier(Object reference)
Set the portal reference to identify this specific portal with-in a zone.void
setIgnoreNoDestination(boolean ignoreNoDestination)
Sets flag to suppress error about missing destination.toString()
This method returns a String that represent the objectprotected boolean
Use the portal.Methods inherited from class games.stendhal.server.entity.Entity
describe, 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, 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, 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
-
ATTR_HIDDEN
The hidden flags attribute name.- See Also:
- Constant Field Values
-
ATTR_USE
- See Also:
- Constant Field Values
-
ATTR_FACE
Attribute for player face direction.- See Also:
- Constant Field Values
-
ATTR_OFFSET
Attribute for player positioning.- See Also:
- Constant Field Values
-
-
Constructor Details
-
Portal
public Portal()Creates a new portal. -
Portal
-
-
Method Details
-
generateRPClass
public static void generateRPClass() -
setIdentifier
Set the portal reference to identify this specific portal with-in a zone. This value is opaque and requires a working equals(), but typically uses a String or Integer.- Parameters:
reference
- A reference tag.
-
setIgnoreNoDestination
public void setIgnoreNoDestination(boolean ignoreNoDestination)Sets flag to suppress error about missing destination. -
getIdentifier
gets the identifier of this portal.- Returns:
- identifier
-
setDestination
Set the destination portal zone and reference. The reference should match the same type/value as that passed to setReference() in the corresponding portal.- Parameters:
zone
- The target zone.reference
- A reference tag.
-
getDestinationReference
-
getDestinationZone
-
isHidden
public boolean isHidden()Determine if this portal is hidden from players. -
setHidden
public void setHidden(boolean hide)Sets or removes the "hidden" attribute.- Parameters:
hide
- Iftrue
, adds "hidden" attribute, otherwise removes it.
-
loaded
public boolean loaded() -
logic
public void logic() -
toString
Description copied from class:RPObject
This method returns a String that represent the object -
usePortal
Use the portal.- Parameters:
player
- the Player who wants to use this portal- Returns:
true
if the portal worked,false
otherwise.
-
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
-
onUsedBackwards
If this portal is the destination of another portal used.- Parameters:
user
- the player who used the other portal teleporting to ushadPath
- determines if entity was using mouse click to use portal
-
onPushedOntoFrom
Sub-classes can override for actions to be taken if entity was pushed onto portal. -
setFaceDirection
Sets the direction attribute for the portal which determines the direction the player should face when this portal is used as a destination.- Parameters:
dir
-Direction
player should face.
-
setFaceDirection
Setup direction player should face after using portal as a destination.dir
can be one of "north", "east", "south", "west", "up", "right", "down", or "left".- Parameters:
dir
-String
representation of direction to face.
-
getFaceDirection
Get the direction player should face when portal is used as a destination.- Returns:
Direction
player should face.
-
hasFaceDirection
public final boolean hasFaceDirection()Check if the portal has defined a direction for player to face when portal is used as a destination.- Returns:
true
if portal's direction attribute is set.
-
getOffset
public final int getOffset()Gets offset positioning value when used as a destination. Valid values are 0-7.- Returns:
Integer
value of offset.
-
hasOffset
public final boolean hasOffset()Checks if portal has an offset positioning when used as a destination.- Returns:
true
if "offset" attribute set.
-