Code clean up for code smells

This commit is contained in:
tastybento 2019-03-07 23:34:27 -08:00
parent c3c6e72384
commit 51c586645a
3 changed files with 48 additions and 43 deletions

View File

@ -54,6 +54,7 @@ public class BSkyBlock extends GameModeAddon {
@Override
public void onDisable() {
// Nothing to do here
}
@Override
@ -107,7 +108,7 @@ public class BSkyBlock extends GameModeAddon {
@Override
public WorldSettings getWorldSettings() {
return settings;
return getSettings();
}
@Override

View File

@ -65,7 +65,6 @@ public class AdminCommand extends CompositeCommand {
new AdminRangeCommand(this);
// Resets
new AdminResetsResetCommand(this);
// TODO new AdminClearresetsallCommand(this);
// Delete
new AdminDeleteCommand(this);
// Why

View File

@ -1,6 +1,6 @@
package world.bentobox.bskyblock.generators;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;
@ -34,7 +34,7 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
@Override
public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, ChunkGenerator.BiomeGrid biomeGrid) {
if (world.getEnvironment().equals(World.Environment.NETHER)) {
return generateNetherChunks(world, random, chunkX, chunkZ, biomeGrid);
return generateNetherChunks(world, random);
}
ChunkData result = createChunkData(world);
if (addon.getSettings().getSeaHeight() != 0) {
@ -61,13 +61,13 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
@Override
public List<BlockPopulator> getDefaultPopulators(final World world) {
return Arrays.asList(new BlockPopulator[0]);
return Collections.emptyList();
}
/*
* Nether Section
*/
private ChunkData generateNetherChunks(World world, Random random, int chunkX, int chunkZ, BiomeGrid biomeGrid) {
private ChunkData generateNetherChunks(World world, Random random) {
ChunkData result = createChunkData(world);
rand.setSeed(world.getSeed());
gen = new PerlinOctaveGenerator((long) (random.nextLong() * random.nextGaussian()), 8);
@ -99,6 +99,15 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
}
}
// Layer 8 may be glowstone
doGlowStone(result, maxHeight, x, z, random);
}
}
}
return result;
}
private void doGlowStone(ChunkData result, int maxHeight, int x, int z, Random random) {
double r = gen.noise(x, (double)maxHeight - 8, z, random.nextFloat(), random.nextFloat());
if (r > 0.5D) {
// Have blobs of glowstone
@ -136,10 +145,6 @@ public class ChunkGeneratorWorld extends ChunkGenerator {
} else {
result.setBlock(x, (maxHeight - 8), z, Material.AIR);
}
}
}
}
return result;
}
}