Added configuration option to allow plugin creature spawns

This commit is contained in:
Zak Ford 2012-07-01 16:02:24 -04:00
parent 0fed35a80f
commit 9b17fe68e7
2 changed files with 7 additions and 0 deletions

View File

@ -98,6 +98,7 @@ public class WorldConfiguration {
public boolean blockFireballExplosions;
public boolean blockFireballBlockDamage;
public boolean blockEntityPaintingDestroy;
public boolean blockPluginSpawning;
public boolean disableContactDamage;
public boolean disableFallDamage;
public boolean disableLavaDamage;
@ -315,6 +316,7 @@ private void loadConfiguration() {
antiWolfDumbness = getBoolean("mobs.anti-wolf-dumbness", false);
disableEndermanGriefing = getBoolean("mobs.disable-enderman-griefing", false);
blockEntityPaintingDestroy = getBoolean("mobs.block-painting-destroy", false);
blockPluginSpawning = getBoolean("mobs.block-plugin-spawning", true);
disableFallDamage = getBoolean("player-damage.disable-fall-damage", false);
disableLavaDamage = getBoolean("player-damage.disable-lava-damage", false);

View File

@ -610,6 +610,11 @@ 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)
return;
EntityType entityType = event.getEntityType();
if (wcfg.blockCreatureSpawn.contains(entityType)) {