Be more lax with entity spawns.

This commit is contained in:
sk89q 2014-08-24 15:53:45 -07:00
parent 913d5d64ae
commit edebb0efc9
2 changed files with 34 additions and 1 deletions

View File

@ -176,6 +176,7 @@ public class WorldConfiguration {
public boolean explosionFlagCancellation; public boolean explosionFlagCancellation;
public boolean disableDeathMessages; public boolean disableDeathMessages;
public boolean disableObsidianGenerators; public boolean disableObsidianGenerators;
public boolean strictEntitySpawn;
private Map<String, Integer> maxRegionCounts; private Map<String, Integer> maxRegionCounts;
@ -314,10 +315,13 @@ private void loadConfiguration() {
summaryOnStart = getBoolean("summary-on-start", true); summaryOnStart = getBoolean("summary-on-start", true);
opPermissions = getBoolean("op-permissions", true); opPermissions = getBoolean("op-permissions", true);
buildPermissions = getBoolean("build-permission-nodes.enable", false); buildPermissions = getBoolean("build-permission-nodes.enable", false);
buildPermissionDenyMessage = CommandUtils.replaceColorMacros( buildPermissionDenyMessage = CommandUtils.replaceColorMacros(
getString("build-permission-nodes.deny-message", "&eSorry, but you are not permitted to do that here.")); getString("build-permission-nodes.deny-message", "&eSorry, but you are not permitted to do that here."));
strictEntitySpawn = getBoolean("strictness.block-entity-spawns-with-untraceable-cause", false);
itemDurability = getBoolean("protection.item-durability", true); itemDurability = getBoolean("protection.item-durability", true);
removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false); removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false);
disableExpDrops = getBoolean("protection.disable-xp-orb-drops", false); disableExpDrops = getBoolean("protection.disable-xp-orb-drops", false);

View File

@ -453,8 +453,37 @@ public void onBlockFromTo(BlockFromToEvent event) {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onCreatureSpawn(CreatureSpawnEvent event) { public void onCreatureSpawn(CreatureSpawnEvent event) {
switch (event.getSpawnReason()) {
case DISPENSE_EGG:
case EGG:
case SPAWNER_EGG:
if (getWorldConfig(event.getEntity().getWorld()).strictEntitySpawn) {
Events.fireToCancel(event, new SpawnEntityEvent(event, Cause.unknown(), event.getEntity())); Events.fireToCancel(event, new SpawnEntityEvent(event, Cause.unknown(), event.getEntity()));
} }
break;
case NATURAL:
case JOCKEY:
case CHUNK_GEN:
case SPAWNER:
case LIGHTNING:
case BUILD_SNOWMAN:
case BUILD_IRONGOLEM:
case BUILD_WITHER:
case VILLAGE_DEFENSE:
case VILLAGE_INVASION:
case BREEDING:
case SLIME_SPLIT:
case REINFORCEMENTS:
case NETHER_PORTAL:
case INFECTION:
case CURED:
case OCELOT_BABY:
case SILVERFISH_BLOCK:
case MOUNT:
case CUSTOM:
case DEFAULT:
}
}
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event) { public void onHangingPlace(HangingPlaceEvent event) {