diff --git a/src/main/java/world/bentobox/boxed/Boxed.java b/src/main/java/world/bentobox/boxed/Boxed.java index ccdfd14..405166b 100644 --- a/src/main/java/world/bentobox/boxed/Boxed.java +++ b/src/main/java/world/bentobox/boxed/Boxed.java @@ -231,7 +231,7 @@ public class Boxed extends GameModeAddon { if (id != null && id.equals("delete")) { return delChunks; } - return worldName.endsWith("_nether") ? netherChunkGenerator : chunkGenerator; + return worldName.endsWith(NETHER) ? netherChunkGenerator : chunkGenerator; } @Override diff --git a/src/main/java/world/bentobox/boxed/generators/AbstractBoxedBiomeGenerator.java b/src/main/java/world/bentobox/boxed/generators/AbstractBoxedBiomeGenerator.java index 2539b13..c71927a 100644 --- a/src/main/java/world/bentobox/boxed/generators/AbstractBoxedBiomeGenerator.java +++ b/src/main/java/world/bentobox/boxed/generators/AbstractBoxedBiomeGenerator.java @@ -25,7 +25,7 @@ import world.bentobox.boxed.Boxed; * @author tastybento * */ -public abstract class AbstractBoxedBiomeGenerator implements BiomeGenerator { +abstract class AbstractBoxedBiomeGenerator implements BiomeGenerator { private static final Map ENV_MAP; static { @@ -77,24 +77,25 @@ public abstract class AbstractBoxedBiomeGenerator implements BiomeGenerator { private SortedMap loadQuad(YamlConfiguration config, String string) { SortedMap result = new TreeMap<>(); - if (config.contains(string)) { - for (String ring : config.getStringList(string)) { - String[] split = ring.split(":"); - if (split.length == 2 && NumberUtils.isNumber(split[0])) { - try { - double d = Double.parseDouble(split[0]); - Biome biome = Enums.getIfPresent(Biome.class, split[1].toUpperCase(Locale.ENGLISH)).orNull(); - if (biome == null) { - addon.logError(split[1].toUpperCase(Locale.ENGLISH) + " is an unknown biome on this server."); - } else { - result.put(d, biome); - } - } catch(Exception e) { - addon.logError(string + ": " + split[0] + " does not seem to be a double. For integers add a .0 to the end"); + if (!config.contains(string)) { + return result; + } + for (String ring : config.getStringList(string)) { + String[] split = ring.split(":"); + if (split.length == 2 && NumberUtils.isNumber(split[0])) { + try { + double d = Double.parseDouble(split[0]); + Biome biome = Enums.getIfPresent(Biome.class, split[1].toUpperCase(Locale.ENGLISH)).orNull(); + if (biome == null) { + addon.logError(split[1].toUpperCase(Locale.ENGLISH) + " is an unknown biome on this server."); + } else { + result.put(d, biome); } - } else { - addon.logError(ring + " must be in the format ratio:biome where ratio is a double."); + } catch(Exception e) { + addon.logError(string + ": " + split[0] + " does not seem to be a double. For integers add a .0 to the end"); } + } else { + addon.logError(ring + " must be in the format ratio:biome where ratio is a double."); } } return result; diff --git a/src/main/java/world/bentobox/boxed/generators/NetherGenerator.java b/src/main/java/world/bentobox/boxed/generators/NetherGenerator.java index b0f8b85..c140f68 100644 --- a/src/main/java/world/bentobox/boxed/generators/NetherGenerator.java +++ b/src/main/java/world/bentobox/boxed/generators/NetherGenerator.java @@ -23,7 +23,8 @@ import world.bentobox.boxed.Boxed; */ public class NetherGenerator implements BaseNoiseGenerator { - private final BiomeNoise DEFAULT_NOISE = new BiomeNoise(10D, 0D, 2D); + private static final String NETHER_BIOMES = "nether.biomes"; + private final BiomeNoise defaultNoise = new BiomeNoise(10D, 0D, 2D); private final NoiseGenerator mainNoiseGenerator; private final Boxed addon; private final YamlConfiguration config; @@ -41,11 +42,11 @@ public class NetherGenerator implements BaseNoiseGenerator { } config = YamlConfiguration.loadConfiguration(biomeFile); biomeNoiseMap = new EnumMap<>(Biome.class); - if (config.isConfigurationSection("nether.biomes")) { - for (String key : config.getConfigurationSection("nether.biomes").getKeys(false)) { - double noiseScaleHorizontal = config.getDouble("nether.biomes." + key + ".scale", 10D); - double height = config.getDouble("nether.biomes." + key + ".height", 0D); - double noiseScaleVertical = config.getDouble("nether.biomes." + key + ".vscale", 2D); + if (config.isConfigurationSection(NETHER_BIOMES)) { + for (String key : config.getConfigurationSection(NETHER_BIOMES).getKeys(false)) { + double noiseScaleHorizontal = config.getDouble(NETHER_BIOMES + "." + key + ".scale", 10D); + double height = config.getDouble(NETHER_BIOMES + "." + key + ".height", 0D); + double noiseScaleVertical = config.getDouble(NETHER_BIOMES + "." + key + ".vscale", 2D); Enums.getIfPresent(Biome.class, key).toJavaUtil() .ifPresent(biome -> biomeNoiseMap.put(biome, new BiomeNoise(noiseScaleHorizontal, height, noiseScaleVertical))); } @@ -92,7 +93,7 @@ public class NetherGenerator implements BaseNoiseGenerator { // edge of island biome = Biome.NETHER_WASTES; } - BiomeNoise bm = this.biomeNoiseMap.getOrDefault(biome, DEFAULT_NOISE); + BiomeNoise bm = this.biomeNoiseMap.getOrDefault(biome, defaultNoise); double x = ((((double)scaledX*4) % dist) / 4) / bm.noiseScaleHorizontal; double z = ((((double)scaledZ*4) % dist) / 4) / bm.noiseScaleHorizontal; for (int y = 0; y < 16; y++) { diff --git a/src/main/java/world/bentobox/boxed/listeners/AdvancementListener.java b/src/main/java/world/bentobox/boxed/listeners/AdvancementListener.java index a98a81d..eb2a303 100644 --- a/src/main/java/world/bentobox/boxed/listeners/AdvancementListener.java +++ b/src/main/java/world/bentobox/boxed/listeners/AdvancementListener.java @@ -235,6 +235,7 @@ public class AdvancementListener implements Listener { user.getPlayer().setStatistic(s, m, 0); } } + break; case ITEM: for (Material m: Material.values()) { if (m.isItem() && !m.isLegacy()) {