Code cleanup.

This commit is contained in:
tastybento 2021-03-03 20:51:31 -08:00
parent 816e1e86be
commit 9c714e10ba
5 changed files with 26 additions and 38 deletions

View File

@ -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);
}

View File

@ -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,6 +171,13 @@ public class Boxed extends GameModeAddon {
}
// Set spawn rates
if (w != null) {
setSpawnRates(w);
}
return w;
}
private void setSpawnRates(World w) {
if (getSettings().getSpawnLimitMonsters() > 0) {
w.setMonsterSpawnLimit(getSettings().getSpawnLimitMonsters());
}
@ -199,9 +197,6 @@ public class Boxed extends GameModeAddon {
w.setTicksPerMonsterSpawns(getSettings().getTicksPerMonsterSpawns());
}
}
return w;
}
@Override
public WorldSettings getWorldSettings() {

View File

@ -1615,10 +1615,6 @@ public class Settings implements WorldSettings {
this.defaultEndBiome = defaultEndBiome;
}
public float getNoiseScaleHorizontal() {
return 10;
}
/**
* @return the seed
*/

View File

@ -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);

View File

@ -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