mirror of
https://github.com/BentoBoxWorld/BSkyBlock.git
synced 2024-11-21 11:35:13 +01:00
Fix deprecation code for setting world settings
This commit is contained in:
parent
98d3a55c50
commit
7a67d2b7f6
@ -2,6 +2,7 @@ package world.bentobox.bskyblock;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.entity.SpawnCategory;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -129,24 +130,25 @@ public class BSkyBlock extends GameModeAddon implements Listener {
|
||||
WorldCreator wc = WorldCreator.name(worldName2).type(WorldType.FLAT).environment(env);
|
||||
World w = settings.isUseOwnGenerator() ? wc.createWorld() : wc.generator(chunkGenerator2).createWorld();
|
||||
// Set spawn rates
|
||||
if (w != null) {
|
||||
// Set spawn rates
|
||||
if (w != null && getSettings() != null) {
|
||||
if (getSettings().getSpawnLimitMonsters() > 0) {
|
||||
w.setMonsterSpawnLimit(getSettings().getSpawnLimitMonsters());
|
||||
w.setSpawnLimit(SpawnCategory.MONSTER, getSettings().getSpawnLimitMonsters());
|
||||
}
|
||||
if (getSettings().getSpawnLimitAmbient() > 0) {
|
||||
w.setAmbientSpawnLimit(getSettings().getSpawnLimitAmbient());
|
||||
w.setSpawnLimit(SpawnCategory.AMBIENT, getSettings().getSpawnLimitAmbient());
|
||||
}
|
||||
if (getSettings().getSpawnLimitAnimals() > 0) {
|
||||
w.setAnimalSpawnLimit(getSettings().getSpawnLimitAnimals());
|
||||
w.setSpawnLimit(SpawnCategory.ANIMAL, getSettings().getSpawnLimitAnimals());
|
||||
}
|
||||
if (getSettings().getSpawnLimitWaterAnimals() > 0) {
|
||||
w.setWaterAnimalSpawnLimit(getSettings().getSpawnLimitWaterAnimals());
|
||||
w.setSpawnLimit(SpawnCategory.WATER_ANIMAL, getSettings().getSpawnLimitWaterAnimals());
|
||||
}
|
||||
if (getSettings().getTicksPerAnimalSpawns() > 0) {
|
||||
w.setTicksPerAnimalSpawns(getSettings().getTicksPerAnimalSpawns());
|
||||
w.setTicksPerSpawns(SpawnCategory.ANIMAL, getSettings().getTicksPerAnimalSpawns());
|
||||
}
|
||||
if (getSettings().getTicksPerMonsterSpawns() > 0) {
|
||||
w.setTicksPerMonsterSpawns(getSettings().getTicksPerMonsterSpawns());
|
||||
w.setTicksPerSpawns(SpawnCategory.MONSTER, getSettings().getTicksPerMonsterSpawns());
|
||||
}
|
||||
}
|
||||
return w;
|
||||
|
Loading…
Reference in New Issue
Block a user