mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-23 19:16:40 +01:00
Be more lax with entity spawns.
This commit is contained in:
parent
913d5d64ae
commit
edebb0efc9
@ -176,6 +176,7 @@ public class WorldConfiguration {
|
||||
public boolean explosionFlagCancellation;
|
||||
public boolean disableDeathMessages;
|
||||
public boolean disableObsidianGenerators;
|
||||
public boolean strictEntitySpawn;
|
||||
|
||||
private Map<String, Integer> maxRegionCounts;
|
||||
|
||||
@ -314,10 +315,13 @@ private void loadConfiguration() {
|
||||
|
||||
summaryOnStart = getBoolean("summary-on-start", true);
|
||||
opPermissions = getBoolean("op-permissions", true);
|
||||
|
||||
buildPermissions = getBoolean("build-permission-nodes.enable", false);
|
||||
buildPermissionDenyMessage = CommandUtils.replaceColorMacros(
|
||||
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);
|
||||
removeInfiniteStacks = getBoolean("protection.remove-infinite-stacks", false);
|
||||
disableExpDrops = getBoolean("protection.disable-xp-orb-drops", false);
|
||||
|
@ -453,7 +453,36 @@ public void onBlockFromTo(BlockFromToEvent event) {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||
Events.fireToCancel(event, new SpawnEntityEvent(event, Cause.unknown(), event.getEntity()));
|
||||
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()));
|
||||
}
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user