Class CreatureProtectionArea
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.CreatureProtectionArea
- All Implemented Interfaces:
Killer
,Cloneable
,Iterable<String>
,Serializable
An area prevents creatures from entering. This allows a layered chain of
criteria. Think of this as a creature firewall.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
An entry representing creature criteria.Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
Whether to block on no match.protected List<CreatureProtectionArea.Entry>
The list (if any specific) of blocked creatures.Fields inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
ATTR_NAME
Fields inherited from class marauroa.common.game.RPObject
INVALID_ID
-
Constructor Summary
ConstructorDescriptionCreate a 1x1 creature protection area.CreatureProtectionArea(int width, int height)
Create a creature protection area.CreatureProtectionArea(int width, int height, boolean defaultBlocked)
Create a creature protection area. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a blocked criteria entry.void
Add a blocked criteria entry.void
Add a criteria entry.boolean
isObstacle(Entity entity)
Checks whether a creature can enter.protected boolean
matchesCriteria(Creature creature, boolean defaultAnswer)
Does a creature match a criteria entry.Methods inherited from class games.stendhal.server.entity.mapstuff.area.AreaEntity
addBehaviour, generateRPClass, getDescriptionName, getName, getTitle, onAdded, onRemoved, setName
Methods 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, 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
-
Field Details
-
defaultBlocked
protected boolean defaultBlockedWhether to block on no match. -
entries
The list (if any specific) of blocked creatures.
-
-
Constructor Details
-
CreatureProtectionArea
public CreatureProtectionArea()Create a 1x1 creature protection area. -
CreatureProtectionArea
public CreatureProtectionArea(int width, int height)Create a creature protection area.- Parameters:
width
- The area width.height
- The area height.
-
CreatureProtectionArea
public CreatureProtectionArea(int width, int height, boolean defaultBlocked)Create a creature protection area.- Parameters:
width
- The area width.height
- The area height.defaultBlocked
- Whether blocked on no match.
-
-
Method Details
-
add
Add a blocked criteria entry.- Parameters:
clazz
- A creature class to match (ornull
for any).
-
add
Add a blocked criteria entry.- Parameters:
clazz
- A creature class to match (ornull
for any).subclazz
- A creature subclass to match (ornull
for any).
-
add
Add a criteria entry.- Parameters:
clazz
- A creature class to match (ornull
for any).subclazz
- A creature subclass to match (ornull
for any).blocked
- Whether to block.
-
matchesCriteria
Does a creature match a criteria entry.- Parameters:
creature
- The creature to compare.defaultAnswer
- The answer if no match is found.- Returns:
- The matching criteria, or default response.
-
isObstacle
Checks whether a creature can enter.- Overrides:
isObstacle
in classEntity
- Parameters:
entity
- The entity to check against.- Returns:
true
if a matching creature is given.
-