diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java b/src/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java index 74ddbc07..d32267b2 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/WorldConfiguration.java @@ -130,6 +130,7 @@ public class WorldConfiguration { public boolean highFreqFlags; public int regionWand; public Set blockCreatureSpawn; + public boolean allowTamedSpawns; // public boolean useiConomy; // public boolean buyOnClaim; // public double buyOnClaimPrice; @@ -356,6 +357,7 @@ private void loadConfiguration() { blockFireballExplosions = getBoolean("mobs.block-fireball-explosions", false); blockFireballBlockDamage = getBoolean("mobs.block-fireball-block-damage", false); antiWolfDumbness = getBoolean("mobs.anti-wolf-dumbness", false); + allowTamedSpawns = getBoolean("mobs.allow-tamed-spawns", true); disableEndermanGriefing = getBoolean("mobs.disable-enderman-griefing", false); disableSnowmanTrails = getBoolean("mobs.disable-snowman-trails", false); blockEntityPaintingDestroy = getBoolean("mobs.block-painting-destroy", false); diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardEntityListener.java b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardEntityListener.java index b96f9daf..2d597766 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardEntityListener.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardEntityListener.java @@ -761,8 +761,15 @@ public void onCreatureSpawn(CreatureSpawnEvent event) { WorldConfiguration wcfg = cfg.get(event.getEntity().getWorld()); // allow spawning of creatures from plugins - if (!wcfg.blockPluginSpawning && event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.CUSTOM) + if (!wcfg.blockPluginSpawning && event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.CUSTOM) { return; + } + + if (wcfg.allowTamedSpawns + && event.getEntity() instanceof Tameable // nullsafe check + && ((Tameable) event.getEntity()).isTamed()) { + return; + } EntityType entityType = event.getEntityType();