From 2c6c59e4aadc82dfee12cc601ae1989972eb612b Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 31 Jul 2021 11:05:40 -0700 Subject: [PATCH] Make fields final --- src/main/java/world/bentobox/boxed/Boxed.java | 6 +++--- .../boxed/generators/BoxedChunkGenerator.java | 2 +- .../bentobox/boxed/generators/NetherGenerator.java | 11 +++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/world/bentobox/boxed/Boxed.java b/src/main/java/world/bentobox/boxed/Boxed.java index d7f20e3..4846824 100644 --- a/src/main/java/world/bentobox/boxed/Boxed.java +++ b/src/main/java/world/bentobox/boxed/Boxed.java @@ -49,7 +49,7 @@ public class Boxed extends GameModeAddon { // Settings private Settings settings; private ChunkGenerator chunkGenerator; - private Config configObject = new Config<>(this, Settings.class); + private final Config configObject = new Config<>(this, Settings.class); private AdvancementsManager advManager; private DeleteGen delChunks; private ChunkGenerator netherChunkGenerator; @@ -103,10 +103,10 @@ public class Boxed extends GameModeAddon { return; } // Check for recommended addons - if (!this.getPlugin().getAddonsManager().getAddonByName("Border").isPresent()) { + if (this.getPlugin().getAddonsManager().getAddonByName("Border").isEmpty()) { this.logWarning("Boxed normally requires the Border addon."); } - if (!this.getPlugin().getAddonsManager().getAddonByName("InvSwitcher").isPresent()) { + if (this.getPlugin().getAddonsManager().getAddonByName("InvSwitcher").isEmpty()) { this.logWarning("Boxed normally requires the InvSwitcher addon for per-world Advancements."); } // Advancements manager diff --git a/src/main/java/world/bentobox/boxed/generators/BoxedChunkGenerator.java b/src/main/java/world/bentobox/boxed/generators/BoxedChunkGenerator.java index c80a136..abe6509 100644 --- a/src/main/java/world/bentobox/boxed/generators/BoxedChunkGenerator.java +++ b/src/main/java/world/bentobox/boxed/generators/BoxedChunkGenerator.java @@ -15,7 +15,7 @@ public class BoxedChunkGenerator { private final WorldRef wordRef; private final Boxed addon; - private WorldRef wordRefNether; + private final WorldRef wordRefNether; public BoxedChunkGenerator(Boxed addon) { this.addon = addon; diff --git a/src/main/java/world/bentobox/boxed/generators/NetherGenerator.java b/src/main/java/world/bentobox/boxed/generators/NetherGenerator.java index c140f68..a0c8e8a 100644 --- a/src/main/java/world/bentobox/boxed/generators/NetherGenerator.java +++ b/src/main/java/world/bentobox/boxed/generators/NetherGenerator.java @@ -27,7 +27,6 @@ public class NetherGenerator implements BaseNoiseGenerator { private final BiomeNoise defaultNoise = new BiomeNoise(10D, 0D, 2D); private final NoiseGenerator mainNoiseGenerator; private final Boxed addon; - private final YamlConfiguration config; private final Map biomeNoiseMap; @@ -40,7 +39,7 @@ public class NetherGenerator implements BaseNoiseGenerator { if (!biomeFile.exists()) { addon.saveResource("biomes.yml", true); } - config = YamlConfiguration.loadConfiguration(biomeFile); + YamlConfiguration config = YamlConfiguration.loadConfiguration(biomeFile); biomeNoiseMap = new EnumMap<>(Biome.class); if (config.isConfigurationSection(NETHER_BIOMES)) { for (String key : config.getConfigurationSection(NETHER_BIOMES).getKeys(false)) { @@ -53,14 +52,14 @@ public class NetherGenerator implements BaseNoiseGenerator { } } - class BiomeNoise { + static class BiomeNoise { double noiseScaleHorizontal = 10D; double height = 0D; double noiseScaleVertical = 2D; /** - * @param noiseScaleHorizontal - * @param height - * @param noiseScaleVertical + * @param noiseScaleHorizontal horizontal noise scale + * @param height height + * @param noiseScaleVertical vertical noise scale */ public BiomeNoise(double noiseScaleHorizontal, double height, double noiseScaleVertical) { this.noiseScaleHorizontal = noiseScaleHorizontal;