Added allow-tamed-spawns setting, on by default.

This will stop WorldGuard from culling tamed animals
in regions with mob-spawning deny when they log in
with their owner.
This commit is contained in:
wizjany 2013-08-20 14:58:46 -04:00
parent 1095064c5e
commit d1e7796f81
2 changed files with 10 additions and 1 deletions

View File

@ -130,6 +130,7 @@ public class WorldConfiguration {
public boolean highFreqFlags;
public int regionWand;
public Set<EntityType> 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);

View File

@ -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();