mirror of
https://github.com/BentoBoxWorld/Boxed.git
synced 2024-12-03 13:23:32 +01:00
Code cleanup.
This commit is contained in:
parent
816e1e86be
commit
9c714e10ba
@ -67,7 +67,7 @@ public class AdvancementsManager {
|
||||
*/
|
||||
@NonNull
|
||||
protected IslandAdvancements getIsland(Island island) {
|
||||
return cache.computeIfAbsent(island.getUniqueId(), k -> getFromDb(k));
|
||||
return cache.computeIfAbsent(island.getUniqueId(), this::getFromDb);
|
||||
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class Boxed extends GameModeAddon {
|
||||
.getInstance(getPlugin(), 0, 5)
|
||||
.createCustomGenerator(wordRef, generator -> {
|
||||
// Set the noise generator
|
||||
generator.setBaseNoiseGenerator(new BasicWorldGenerator(this, wordRef, getSettings().getSeed()));
|
||||
generator.setBaseNoiseGenerator(new BasicWorldGenerator(this, getSettings().getSeed()));
|
||||
if (getSettings().isAllowStructures()) {
|
||||
generator.getWorldDecorator().withoutDefaultDecorations(DecorationType.SURFACE_STRUCTURES);
|
||||
}
|
||||
@ -74,15 +74,8 @@ public class Boxed extends GameModeAddon {
|
||||
generator.setBiomeGenerator(new BoxedBiomeGenerator(this));
|
||||
});
|
||||
// Register commands
|
||||
playerCommand = new DefaultPlayerCommand(this)
|
||||
playerCommand = new DefaultPlayerCommand(this) {};
|
||||
|
||||
{
|
||||
@Override
|
||||
public void setup()
|
||||
{
|
||||
super.setup();
|
||||
}
|
||||
};
|
||||
adminCommand = new DefaultAdminCommand(this) {};
|
||||
|
||||
// Register listeners
|
||||
@ -104,8 +97,6 @@ public class Boxed extends GameModeAddon {
|
||||
|
||||
@Override
|
||||
public void onEnable(){
|
||||
// Register this
|
||||
//registerListener(new JoinListener(this));
|
||||
// Advancements manager
|
||||
advManager = new AdvancementsManager(this);
|
||||
// Get delete chunk generator
|
||||
@ -180,29 +171,33 @@ public class Boxed extends GameModeAddon {
|
||||
}
|
||||
// Set spawn rates
|
||||
if (w != null) {
|
||||
if (getSettings().getSpawnLimitMonsters() > 0) {
|
||||
w.setMonsterSpawnLimit(getSettings().getSpawnLimitMonsters());
|
||||
}
|
||||
if (getSettings().getSpawnLimitAmbient() > 0) {
|
||||
w.setAmbientSpawnLimit(getSettings().getSpawnLimitAmbient());
|
||||
}
|
||||
if (getSettings().getSpawnLimitAnimals() > 0) {
|
||||
w.setAnimalSpawnLimit(getSettings().getSpawnLimitAnimals());
|
||||
}
|
||||
if (getSettings().getSpawnLimitWaterAnimals() > 0) {
|
||||
w.setWaterAnimalSpawnLimit(getSettings().getSpawnLimitWaterAnimals());
|
||||
}
|
||||
if (getSettings().getTicksPerAnimalSpawns() > 0) {
|
||||
w.setTicksPerAnimalSpawns(getSettings().getTicksPerAnimalSpawns());
|
||||
}
|
||||
if (getSettings().getTicksPerMonsterSpawns() > 0) {
|
||||
w.setTicksPerMonsterSpawns(getSettings().getTicksPerMonsterSpawns());
|
||||
}
|
||||
setSpawnRates(w);
|
||||
}
|
||||
return w;
|
||||
|
||||
}
|
||||
|
||||
private void setSpawnRates(World w) {
|
||||
if (getSettings().getSpawnLimitMonsters() > 0) {
|
||||
w.setMonsterSpawnLimit(getSettings().getSpawnLimitMonsters());
|
||||
}
|
||||
if (getSettings().getSpawnLimitAmbient() > 0) {
|
||||
w.setAmbientSpawnLimit(getSettings().getSpawnLimitAmbient());
|
||||
}
|
||||
if (getSettings().getSpawnLimitAnimals() > 0) {
|
||||
w.setAnimalSpawnLimit(getSettings().getSpawnLimitAnimals());
|
||||
}
|
||||
if (getSettings().getSpawnLimitWaterAnimals() > 0) {
|
||||
w.setWaterAnimalSpawnLimit(getSettings().getSpawnLimitWaterAnimals());
|
||||
}
|
||||
if (getSettings().getTicksPerAnimalSpawns() > 0) {
|
||||
w.setTicksPerAnimalSpawns(getSettings().getTicksPerAnimalSpawns());
|
||||
}
|
||||
if (getSettings().getTicksPerMonsterSpawns() > 0) {
|
||||
w.setTicksPerMonsterSpawns(getSettings().getTicksPerMonsterSpawns());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorldSettings getWorldSettings() {
|
||||
return getSettings();
|
||||
|
@ -1615,10 +1615,6 @@ public class Settings implements WorldSettings {
|
||||
this.defaultEndBiome = defaultEndBiome;
|
||||
}
|
||||
|
||||
public float getNoiseScaleHorizontal() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the seed
|
||||
*/
|
||||
|
@ -8,7 +8,6 @@ import org.bukkit.util.noise.SimplexNoiseGenerator;
|
||||
|
||||
import nl.rutgerkok.worldgeneratorapi.BaseNoiseGenerator;
|
||||
import nl.rutgerkok.worldgeneratorapi.BiomeGenerator;
|
||||
import nl.rutgerkok.worldgeneratorapi.WorldRef;
|
||||
import world.bentobox.boxed.Boxed;
|
||||
|
||||
/**
|
||||
@ -22,7 +21,7 @@ public class BasicWorldGenerator implements BaseNoiseGenerator {
|
||||
private final YamlConfiguration config;
|
||||
|
||||
|
||||
public BasicWorldGenerator(Boxed addon, WorldRef world, long seed) {
|
||||
public BasicWorldGenerator(Boxed addon, long seed) {
|
||||
this.addon = addon;
|
||||
// Initialize the noise generator based on the world seed
|
||||
this.mainNoiseGenerator = new SimplexNoiseGenerator(seed);
|
||||
|
@ -24,8 +24,6 @@ public class DeleteGen extends ChunkGenerator {
|
||||
public DeleteGen(Boxed addon) {
|
||||
backMap = new HashMap<>();
|
||||
backMap.put(addon.getOverWorld(), Bukkit.getWorld(addon.getOverWorld().getName() + "_bak"));
|
||||
//backMap.put(addon.getNetherWorld(), Bukkit.getWorld(addon.getNetherWorld().getName() + "_bak"));
|
||||
//backMap.put(addon.getEndWorld(), Bukkit.getWorld(addon.getEndWorld().getName() + "_bak"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user