mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-01-12 03:13:40 +01:00
Added MOB_SPAWNING state flag.
This commit is contained in:
parent
7038f49a1a
commit
28c44e0b2f
@ -365,15 +365,27 @@ public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
|
||||
ConfigurationManager cfg = plugin.getGlobalConfiguration();
|
||||
WorldConfiguration wcfg = cfg.get(event.getEntity().getWorld());
|
||||
|
||||
|
||||
//CreatureType creaType = (CreatureType) CreatureType.valueOf(event.getMobType().toString());
|
||||
CreatureType creaType = event.getCreatureType();
|
||||
CreatureType creaType = event.getCreatureType();
|
||||
Boolean cancelEvent = false;
|
||||
|
||||
if (wcfg.blockCreatureSpawn.contains(creaType)) {
|
||||
cancelEvent = true;
|
||||
}
|
||||
|
||||
Location eventLoc = event.getLocation();
|
||||
|
||||
if (wcfg.useRegions) {
|
||||
Vector pt = toVector(eventLoc);
|
||||
RegionManager mgr = plugin.getGlobalRegionManager().get(eventLoc.getWorld());
|
||||
ApplicableRegionSet set = mgr.getApplicableRegions(pt);
|
||||
|
||||
if (!set.allows(DefaultFlag.MOB_SPAWNING)) {
|
||||
cancelEvent = true;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Monsters and stuff
|
||||
/*
|
||||
if (wcfg.useRegions) {
|
||||
|
@ -29,6 +29,7 @@ public final class DefaultFlag {
|
||||
public static final StateFlag BUILD = new StateFlag("build", 'b', true);
|
||||
public static final StateFlag PVP = new StateFlag("pvp", 'p', true);
|
||||
public static final StateFlag MOB_DAMAGE = new StateFlag("mob-damage", 'm', true);
|
||||
public static final StateFlag MOB_SPAWNING = new StateFlag("mob-spawning", 'M', true);
|
||||
public static final StateFlag CREEPER_EXPLOSION = new StateFlag("creeper-explosion", 'c', true);
|
||||
public static final StateFlag TNT = new StateFlag("tnt", 't', true);
|
||||
public static final StateFlag LIGHTER = new StateFlag("lighter", 'l', true);
|
||||
@ -54,7 +55,7 @@ public final class DefaultFlag {
|
||||
public static final DoubleFlag PRICE = new DoubleFlag("price");
|
||||
|
||||
public static final Flag<?>[] flagsList = new Flag<?>[] {
|
||||
PASSTHROUGH, BUILD, PVP, MOB_DAMAGE, CREEPER_EXPLOSION,
|
||||
PASSTHROUGH, BUILD, PVP, MOB_DAMAGE, MOB_SPAWNING, CREEPER_EXPLOSION,
|
||||
TNT, LIGHTER, FIRE_SPREAD, LAVA_FIRE, CHEST_ACCESS, WATER_FLOW, LAVA_FLOW,
|
||||
USE, PLACE_VEHICLE, GREET_MESSAGE, FAREWELL_MESSAGE, NOTIFY_GREET,
|
||||
NOTIFY_FAREWELL, DENY_SPAWN, HEAL_DELAY, HEAL_AMOUNT, TELE_LOC,
|
||||
|
Loading…
Reference in New Issue
Block a user