Class HousePortal
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
games.stendhal.server.entity.mapstuff.portal.HousePortal
- All Implemented Interfaces:
UseListener
,Killer
,Cloneable
,Iterable<String>
,Serializable
A portal that can be used with a matching
HouseKey
.
The requirements are saved with the portal.-
Nested Class Summary
Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Override continuous movement setting.protected boolean
Immediate execution of action when player says password.protected int
Radius at which portal will "listen" for speaking players.protected String
Optional message to give when correct password used.protected String
Optional message to give when incorrect password used.protected int
ID for the portalprotected static int
protected ChatAction
Optional action to take when access is rejected.protected String
The message to give when rejected.protected String
Optional password to use portal.Fields inherited from class games.stendhal.server.entity.mapstuff.portal.Portal
ATTR_FACE, ATTR_HIDDEN, ATTR_OFFSET, ATTR_USE
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
ConstructorDescriptionHousePortal(String doorId)
Create a HousePortal.HousePortal(RPObject object)
Create a HousePortal from anRPObject
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Increase the lock number by one.describe()
Describes the entity (if a players looks at it).static void
Gets other zones that should hear knocking on door.Gets other zones that should hear knocking on door.Get the identification string of this portal.long
Get the expiration time of the portal.int
int
Get the number of the lock.getOwner()
Get the name of the owner.int
Get the house number of this portal.Gets the message to send when player is denied access to portal.Gets the password required to use the portal.boolean
Checks if the portal executes an action immediately after password is said.protected boolean
Determine if this portal can be used.void
logic()
boolean
Use the portal, if allowed.boolean
playerIsPortalUnlocked(Player player, Portal portal)
protected void
Called when the user is rejected.protected void
sendMessage(RPEntity user, String text)
Wrapper to send a message to a user, without getting lost.void
setAssociatedZones(String zones)
Sets other zones that should hear knocking on door.void
setDestination(String zone, Object id)
Set the destination portal zone and reference.void
setExpireTime(long time)
Set the expiration time of the portal.void
setForceStop(boolean forceStop)
Sets flag to override continuous movement & force entity to stop.void
setIdentifier(Object id)
Set the portal reference to identify this specific portal with-in a zone.void
setInstantAction(boolean instant)
void
setListeningRadius(int radius)
Sets the radius at which the portal will "hear" speaking players.void
Sets the owner of this portal.void
setPasswordAcceptedMessage(String message)
Set the password accepted message.void
setPasswordRejectedMessage(String message)
Set the password rejected message.void
setRejectedAction(ChatAction rejectedAction)
Initiates an action to take on rejection.void
setRejectedMessage(String message)
Set the rejection message.void
setRequiredPassword(String password)
Methods inherited from class games.stendhal.server.entity.mapstuff.portal.Portal
getDestinationReference, getDestinationZone, getFaceDirection, getIdentifier, getOffset, hasFaceDirection, hasOffset, isHidden, loaded, onPushedOntoFrom, onUsedBackwards, setFaceDirection, setFaceDirection, setHidden, setIgnoreNoDestination, toString, usePortal
Methods inherited from class games.stendhal.server.entity.Entity
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
-
instantAction
protected boolean instantActionImmediate execution of action when player says password. -
listeningRadius
protected int listeningRadiusRadius at which portal will "listen" for speaking players. -
passwordAcceptedMessage
Optional message to give when correct password used. -
passwordRejectedMessage
Optional message to give when incorrect password used. -
portalID
protected int portalIDID for the portal -
portalIDCounter
protected static int portalIDCounter -
rejectedMessage
The message to give when rejected. -
requiredPassword
Optional password to use portal. -
rejectedAction
Optional action to take when access is rejected. -
forceStop
protected boolean forceStopOverride continuous movement setting.
-
-
Constructor Details
-
HousePortal
Create a HousePortal.- Parameters:
doorId
- the door identifier
-
HousePortal
Create a HousePortal from anRPObject
. Used when restoring from the database.- Parameters:
object
- the correspondingRPObject
-
-
Method Details
-
generateRPClass
public static void generateRPClass() -
setOwner
Sets the owner of this portal.- Parameters:
owner
- name of the owner.
-
setDestination
Description copied from class:Portal
Set the destination portal zone and reference. The reference should match the same type/value as that passed to setReference() in the corresponding portal.- Overrides:
setDestination
in classPortal
- Parameters:
zone
- The target zone.id
- A reference tag.
-
setIdentifier
Description copied from class:Portal
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.- Overrides:
setIdentifier
in classPortal
- Parameters:
id
- A reference tag.
-
describe
Description copied from class:Entity
Describes the entity (if a players looks at it). -
isAllowed
Determine if this portal can be used.- Parameters:
user
- The user to be checked.- Returns:
true
if the user can use the portal.
-
getDoorId
Get the identification string of this portal.- Returns:
- the identification string
-
getPortalNumber
public int getPortalNumber()Get the house number of this portal.- Returns:
- the house number, or 0 if house number not found
-
getOwner
Get the name of the owner.- Returns:
- owner
-
getLockNumber
public int getLockNumber()Get the number of the lock.- Returns:
- number of the lock
-
changeLock
public void changeLock()Increase the lock number by one. -
getExpireTime
public long getExpireTime()Get the expiration time of the portal.- Returns:
- time in milliseconds
-
setExpireTime
public void setExpireTime(long time)Set the expiration time of the portal.- Parameters:
time
- time in milliseconds
-
setAssociatedZones
Sets other zones that should hear knocking on door.- Parameters:
zones
- Comma-separated string of zone names.
-
getAssociatedZones
Gets other zones that should hear knocking on door. -
getAssociatedZonesList
Gets other zones that should hear knocking on door. -
getPasswordAcceptedMessage
- Returns:
- Message when password is accepted.
-
getPasswordRejectedMessage
- Returns:
- Messager when password is rejected.
-
getListeningRadius
public int getListeningRadius()- Returns:
- Radius at which portal detects player speech.
-
getRejectedMessage
Gets the message to send when player is denied access to portal.- Returns:
- Rejected message
-
getRequiredPassword
Gets the password required to use the portal.- Returns:
- Required password
-
hasInstanceAction
public boolean hasInstanceAction()Checks if the portal executes an action immediately after password is said.- Returns:
- instantAction
-
playerIsPortalUnlocked
-
logic
public void logic() -
onUsed
Use the portal, if allowed.- Specified by:
onUsed
in interfaceUseListener
- Overrides:
onUsed
in classPortal
- Parameters:
user
- that wants to pass.- Returns:
- true if passed , false otherwise.
-
rejected
Called when the user is rejected. This sends a rejection message to the user if set.- Parameters:
user
- The rejected user.
-
sendMessage
Wrapper to send a message to a user, without getting lost.- Parameters:
user
- The user to send to.text
- The message to send.
-
setInstantAction
public void setInstantAction(boolean instant)- Parameters:
instant
- Use portal automatically.
-
setPasswordAcceptedMessage
Set the password accepted message.- Parameters:
message
- Optional message to be given when correct password used.
-
setPasswordRejectedMessage
Set the password rejected message.- Parameters:
message
- Optional message to be given when incorrect password used.
-
setListeningRadius
public void setListeningRadius(int radius)Sets the radius at which the portal will "hear" speaking players.- Parameters:
radius
- Distance at wich portal listens for players speaking.
-
setRejectedMessage
Set the rejection message.- Parameters:
message
- The message to give when rejected.
-
setRequiredPassword
- Parameters:
password
-
-
setRejectedAction
Initiates an action to take on rejection.- Parameters:
rejectedAction
- ChatAction to execute.
-
setForceStop
public void setForceStop(boolean forceStop)Sets flag to override continuous movement & force entity to stop.- Parameters:
forceStop
- Iftrue
, entity is forced to stop movement.
-