From d0b5ffa339adf47666e81796be05efbbd7c2a0f5 Mon Sep 17 00:00:00 2001 From: Brianna Date: Tue, 30 Mar 2021 12:51:04 -0500 Subject: [PATCH] Added the ability to ignore the max entity count on first spawn. --- src/main/java/com/songoda/epicspawners/settings/Settings.java | 4 ++++ .../spawners/spawner/option/SpawnOptionEntity_1_12.java | 4 ++++ .../spawners/spawner/option/SpawnOptionEntity_1_13.java | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/main/java/com/songoda/epicspawners/settings/Settings.java b/src/main/java/com/songoda/epicspawners/settings/Settings.java index f2dd5d9..c44d6d1 100644 --- a/src/main/java/com/songoda/epicspawners/settings/Settings.java +++ b/src/main/java/com/songoda/epicspawners/settings/Settings.java @@ -125,6 +125,10 @@ public class Settings { "This value depicts the variable {RAND} in equations used by this plugin", "It generates a random number between (by default) 1 and 4."); + public static final ConfigSetting IGNORE_MAX_ON_FIRST_SPAWN = new ConfigSetting(config, "Main.Ignore Max On First Spawn", false, + "Should the max entity count around spawners be", + "ignored on their first spawn?"); + public static final ConfigSetting REMOVE_CORRUPTED_SPAWNERS = new ConfigSetting(config, "Main.Remove Corrupted Spawners", true, "Should spawners without valid values be removed?", "This may need to be disabled for compatibility that use", diff --git a/src/main/java/com/songoda/epicspawners/spawners/spawner/option/SpawnOptionEntity_1_12.java b/src/main/java/com/songoda/epicspawners/spawners/spawner/option/SpawnOptionEntity_1_12.java index 5724a2d..99cc681 100644 --- a/src/main/java/com/songoda/epicspawners/spawners/spawner/option/SpawnOptionEntity_1_12.java +++ b/src/main/java/com/songoda/epicspawners/spawners/spawner/option/SpawnOptionEntity_1_12.java @@ -172,6 +172,10 @@ public class SpawnOptionEntity_1_12 implements SpawnOption { maxEntitiesAllowed = ((SpawnConditionNearbyEntities) spawnCondition).getMax(); } + // Should we skip the max entity amount on first spawn? + if (spawner.getSpawnCount() == 0 && Settings.IGNORE_MAX_ON_FIRST_SPAWN.getBoolean()) + maxEntitiesAllowed = Integer.MAX_VALUE; + // Get the amount of entities around the spawner. int size = SpawnConditionNearbyEntities.getEntitiesAroundSpawner(location, true); diff --git a/src/main/java/com/songoda/epicspawners/spawners/spawner/option/SpawnOptionEntity_1_13.java b/src/main/java/com/songoda/epicspawners/spawners/spawner/option/SpawnOptionEntity_1_13.java index a0b24ad..ea8b938 100644 --- a/src/main/java/com/songoda/epicspawners/spawners/spawner/option/SpawnOptionEntity_1_13.java +++ b/src/main/java/com/songoda/epicspawners/spawners/spawner/option/SpawnOptionEntity_1_13.java @@ -219,6 +219,10 @@ public class SpawnOptionEntity_1_13 implements SpawnOption { maxEntitiesAllowed = ((SpawnConditionNearbyEntities) spawnCondition).getMax(); } + // Should we skip the max entity amount on first spawn? + if (spawner.getSpawnCount() == 0 && Settings.IGNORE_MAX_ON_FIRST_SPAWN.getBoolean()) + maxEntitiesAllowed = Integer.MAX_VALUE; + // Get the amount of entities around the spawner. int size = SpawnConditionNearbyEntities.getEntitiesAroundSpawner(location, true);