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
Nested ClassesModifier and TypeClassDescriptionprotected static classAn entry representing creature criteria.Nested classes/interfaces inherited from class marauroa.common.game.RPObject
RPObject.ID -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether 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_NAMEFields inherited from class marauroa.common.game.RPObject
INVALID_ID -
Constructor Summary
ConstructorsConstructorDescriptionCreate 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 TypeMethodDescriptionvoidAdd a blocked criteria entry.voidAdd a blocked criteria entry.voidAdd a criteria entry.booleanisObstacle(Entity entity) Checks whether a creature can enter.protected booleanmatchesCriteria(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, setNameMethods 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, 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
-
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 (ornullfor any).
-
add
Add a blocked criteria entry.- Parameters:
clazz- A creature class to match (ornullfor any).subclazz- A creature subclass to match (ornullfor any).
-
add
Add a criteria entry.- Parameters:
clazz- A creature class to match (ornullfor any).subclazz- A creature subclass to match (ornullfor 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:
isObstaclein classEntity- Parameters:
entity- The entity to check against.- Returns:
trueif a matching creature is given.
-