Skip to content

Commit 0d6260a

Browse files
authored
Merge pull request #116 from BentoBoxWorld/spawner_set_fix
Fix for setting spawners to avoid errors with minimums
2 parents acbad5c + 36c0b59 commit 0d6260a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<!-- Do not change unless you want different name for local builds. -->
6363
<build.number>-LOCAL</build.number>
6464
<!-- This allows to change between versions. -->
65-
<build.version>3.2.0</build.version>
65+
<build.version>3.2.1</build.version>
6666

6767
<sonar.projectKey>BentoBoxWorld_Boxed</sonar.projectKey>
6868
<sonar.organization>bentobox-world</sonar.organization>

src/main/java/world/bentobox/boxed/generators/chunks/BoxedBlockPopulator.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,16 @@ else if (bs instanceof Banner banner && bpBlock.getBannerPatterns() != null) {
115115
public void setSpawner(CreatureSpawner spawner, BlueprintCreatureSpawner s) {
116116
spawner.setSpawnedType(s.getSpawnedType());
117117
spawner.setMaxNearbyEntities(s.getMaxNearbyEntities());
118-
spawner.setMaxSpawnDelay(s.getMaxSpawnDelay());
119-
spawner.setMinSpawnDelay(s.getMinSpawnDelay());
118+
int delay = Math.max(s.getMinSpawnDelay(), s.getMaxSpawnDelay());
119+
if (delay < 1) {
120+
delay = 120; // Set the default 2 minutes
121+
}
122+
spawner.setMaxSpawnDelay(delay);
123+
delay = Math.max(s.getMinSpawnDelay(), 1);
124+
spawner.setMinSpawnDelay(delay);
120125
spawner.setDelay(s.getDelay());
121-
spawner.setRequiredPlayerRange(s.getRequiredPlayerRange());
126+
int range = Math.max(s.getRequiredPlayerRange(), 0);
127+
spawner.setRequiredPlayerRange(range);
122128
spawner.setSpawnRange(s.getSpawnRange());
123129
spawner.update(true, false);
124130
}

0 commit comments

Comments
 (0)