final class ReplacementHandler
extends java.lang.Object
implements org.bukkit.event.Listener
| Modifier and Type | Field and Description |
|---|---|
private static java.util.Set<java.lang.String> |
ADMINS
A set containing the names of all administrators.
|
private static java.util.Map<Zone,java.util.HashSet<Replacement>> |
REPLACEMENTS
A mapping from each
Zone to a set of per-zone replacements. |
| Constructor and Description |
|---|
ReplacementHandler()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
addReplacement(Zone zone,
org.bukkit.entity.EntityType from,
org.bukkit.entity.EntityType to,
double probability)
Adds a replacement.
|
private static org.bukkit.entity.EntityType |
getReplacement(Zone zone,
org.bukkit.entity.EntityType from)
If successful, returns the
EntityType to replace the given type. |
(package private) static java.util.HashSet<Replacement> |
getReplacements(Zone zone)
Returns all replacements for a given zone.
|
protected void |
onCreatureSpawn(org.bukkit.event.entity.CreatureSpawnEvent e)
Handles replacements whenever a creature spawns.
|
(package private) static boolean |
removeReplacement(Zone zone,
org.bukkit.entity.EntityType from)
Remove a particular replacement from a particular zone.
|
(package private) static void |
removeReplacements(Zone zone)
Remove all replacements for a particular zone.
|
private static final java.util.Map<Zone,java.util.HashSet<Replacement>> REPLACEMENTS
Zone to a set of per-zone replacements.
f: Zone -> Replacementsprivate static final java.util.Set<java.lang.String> ADMINS
static void addReplacement(Zone zone, org.bukkit.entity.EntityType from, org.bukkit.entity.EntityType to, double probability)
zone - the zone.from - the EntityType to be replaced.to - the replacement EntityType.probability - the probability of this replacement occurring, from [0.0, 1.0].private static org.bukkit.entity.EntityType getReplacement(Zone zone, org.bukkit.entity.EntityType from)
EntityType to replace the given type. A failure will occur if the
zone does not have a defined replacement for the given type, or if the probability filter fails. Will
return null upon failure, representing no change.zone - the zone.from - the EntityType to replace.EntityType upon success, or null upon failure.static void removeReplacements(Zone zone)
zone - the zone.static boolean removeReplacement(Zone zone, org.bukkit.entity.EntityType from)
zone - the zone.from - the EntityType to be replaced.static java.util.HashSet<Replacement> getReplacements(Zone zone)
zone - the zone.protected void onCreatureSpawn(org.bukkit.event.entity.CreatureSpawnEvent e)
e - the CreatureSpawnEvent.