From 18c6d4206a584c4466d94539918e3e756598cb87 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 10 Nov 2024 14:20:36 -0800 Subject: [PATCH] Update to 1.21.3 and CodeMC --- pom.xml | 24 +++-- .../listeners/GeneratorListener.java | 2 +- .../utils/Utils.java | 89 +++++++------------ src/main/resources/plugin.yml | 4 +- 4 files changed, 44 insertions(+), 75 deletions(-) diff --git a/pom.xml b/pom.xml index 20a8ba6..ff42ad3 100644 --- a/pom.xml +++ b/pom.xml @@ -34,8 +34,8 @@ UTF-8 17 - 1.20.4-R0.1-SNAPSHOT - 2.0.0-SNAPSHOT + 1.21.3-R0.1-SNAPSHOT + 2.7.1-SNAPSHOT 2.5.0 1.4.0 @@ -47,7 +47,7 @@ ${build.version}-SNAPSHOT - 2.5.2 + 2.6.0 -LOCAL BentoBoxWorld_MagicCobblestoneGenerator @@ -87,13 +87,9 @@ - - codemc-snapshots - https://repo.codemc.io/repository/maven-snapshots - - codemc-releases - https://repo.codemc.io/repository/maven-releases + bentoboxworld + https://repo.codemc.io/repository/bentoboxworld/ @@ -110,14 +106,14 @@ https://hub.spigotmc.org/nexus/content/repositories/snapshots/ - codemc-repo - https://repo.codemc.io/repository/maven-public/ + bentoboxworld + https://repo.codemc.io/repository/bentoboxoworld/ - - vault-repo - https://nexus.hc.to/content/repositories/pub_releases + codemc-repo + https://repo.codemc.io/repository/maven-public/ + jitpack.io https://jitpack.io diff --git a/src/main/java/world/bentobox/magiccobblestonegenerator/listeners/GeneratorListener.java b/src/main/java/world/bentobox/magiccobblestonegenerator/listeners/GeneratorListener.java index 40439aa..7f9ae7f 100644 --- a/src/main/java/world/bentobox/magiccobblestonegenerator/listeners/GeneratorListener.java +++ b/src/main/java/world/bentobox/magiccobblestonegenerator/listeners/GeneratorListener.java @@ -136,7 +136,7 @@ protected void playEffects(Block block) // This spawns 8 large smoke particles. for (int counter = 0; counter < 8; ++counter) { - block.getWorld().spawnParticle(Particle.SMOKE_LARGE, + block.getWorld().spawnParticle(Particle.SMOKE, blockX + Math.random(), blockY + 1 + Math.random(), blockZ + Math.random(), diff --git a/src/main/java/world/bentobox/magiccobblestonegenerator/utils/Utils.java b/src/main/java/world/bentobox/magiccobblestonegenerator/utils/Utils.java index 22c9cf7..18b6074 100644 --- a/src/main/java/world/bentobox/magiccobblestonegenerator/utils/Utils.java +++ b/src/main/java/world/bentobox/magiccobblestonegenerator/utils/Utils.java @@ -9,7 +9,6 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; @@ -19,6 +18,7 @@ import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.Registry; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.entity.EntityType; @@ -295,18 +295,8 @@ public static T getPreviousValue(T[] values, T currentValue) * * @return Map that contains relation from biome name to biome. */ - public static Map getBiomeNameMap() - { - Biome[] biomes = Biome.values(); - - Map returnMap = new HashMap<>(biomes.length); - - for (Biome biome : biomes) - { - returnMap.put(biome.name(), biome); - } - - return returnMap; + public static Map getBiomeNameMap() { + return Registry.BIOME.stream().collect(Collectors.toMap(biome -> biome.name(), biome -> biome)); } @@ -398,11 +388,8 @@ public static String sanitizeInput(String input) */ public static boolean isSnowyBiome(Biome biome) { - return switch (biome) { - //case SNOWY_SLOPES: - case SNOWY_PLAINS, SNOWY_TAIGA, ICE_SPIKES, FROZEN_RIVER, SNOWY_BEACH -> true; - default -> false; - }; + return biome == Biome.SNOWY_PLAINS || biome == Biome.SNOWY_TAIGA || biome == Biome.ICE_SPIKES + || biome == Biome.FROZEN_RIVER || biome == Biome.SNOWY_BEACH; } @@ -414,10 +401,9 @@ public static boolean isSnowyBiome(Biome biome) */ public static boolean isColdBiome(Biome biome) { - return switch (biome) { - case WINDSWEPT_HILLS, WINDSWEPT_GRAVELLY_HILLS, WINDSWEPT_FOREST, TAIGA, OLD_GROWTH_PINE_TAIGA, OLD_GROWTH_SPRUCE_TAIGA, STONY_SHORE -> true; - default -> false; - }; + return biome == Biome.WINDSWEPT_HILLS || biome == Biome.WINDSWEPT_GRAVELLY_HILLS + || biome == Biome.WINDSWEPT_FOREST || biome == Biome.TAIGA || biome == Biome.OLD_GROWTH_PINE_TAIGA + || biome == Biome.OLD_GROWTH_SPRUCE_TAIGA || biome == Biome.STONY_SHORE; } @@ -429,10 +415,11 @@ public static boolean isColdBiome(Biome biome) */ public static boolean isTemperateBiome(Biome biome) { - return switch (biome) { - case PLAINS, SUNFLOWER_PLAINS, FOREST, FLOWER_FOREST, BIRCH_FOREST, OLD_GROWTH_BIRCH_FOREST, DARK_FOREST, SWAMP, JUNGLE, SPARSE_JUNGLE, BAMBOO_JUNGLE, RIVER, BEACH, MUSHROOM_FIELDS -> true; - default -> false; - }; + return biome == Biome.PLAINS || biome == Biome.SUNFLOWER_PLAINS || biome == Biome.FOREST + || biome == Biome.FLOWER_FOREST || biome == Biome.BIRCH_FOREST || biome == Biome.OLD_GROWTH_BIRCH_FOREST + || biome == Biome.DARK_FOREST || biome == Biome.SWAMP || biome == Biome.JUNGLE + || biome == Biome.SPARSE_JUNGLE || biome == Biome.BAMBOO_JUNGLE || biome == Biome.RIVER + || biome == Biome.BEACH || biome == Biome.MUSHROOM_FIELDS; } @@ -444,12 +431,9 @@ public static boolean isTemperateBiome(Biome biome) */ public static boolean isWarmBiome(Biome biome) { - return switch (biome) { - case DESERT, SAVANNA, WINDSWEPT_SAVANNA, BADLANDS, ERODED_BADLANDS, WOODED_BADLANDS, SAVANNA_PLATEAU -> - // case BADLANDS_PLATEAU: - true; - default -> false; - }; + return biome == Biome.DESERT || biome == Biome.SAVANNA || biome == Biome.WINDSWEPT_SAVANNA + || biome == Biome.BADLANDS || biome == Biome.ERODED_BADLANDS || biome == Biome.WOODED_BADLANDS + || biome == Biome.SAVANNA_PLATEAU; } @@ -461,10 +445,9 @@ public static boolean isWarmBiome(Biome biome) */ public static boolean isAquaticBiome(Biome biome) { - return switch (biome) { - case WARM_OCEAN, LUKEWARM_OCEAN, DEEP_LUKEWARM_OCEAN, OCEAN, DEEP_OCEAN, COLD_OCEAN, DEEP_COLD_OCEAN, FROZEN_OCEAN, DEEP_FROZEN_OCEAN -> true; - default -> false; - }; + return biome == Biome.WARM_OCEAN || biome == Biome.LUKEWARM_OCEAN || biome == Biome.DEEP_LUKEWARM_OCEAN + || biome == Biome.OCEAN || biome == Biome.DEEP_OCEAN || biome == Biome.COLD_OCEAN + || biome == Biome.DEEP_COLD_OCEAN || biome == Biome.FROZEN_OCEAN || biome == Biome.DEEP_FROZEN_OCEAN; } @@ -486,12 +469,8 @@ public static boolean isNeutralBiome(Biome biome) * @param biome Biome that must be checked. * @return {@code true} if I think it is cave biome, {@code false} otherwise. */ - public static boolean isCaveBiome(Biome biome) - { - return switch (biome) { - case LUSH_CAVES, DRIPSTONE_CAVES -> true; - default -> false; - }; + public static boolean isCaveBiome(Biome biome) { + return biome == Biome.LUSH_CAVES || biome == Biome.DRIPSTONE_CAVES; } @@ -501,12 +480,9 @@ public static boolean isCaveBiome(Biome biome) * @param biome Biome that must be checked. * @return {@code true} if I think it is nether biome, {@code false} otherwise. */ - public static boolean isNetherBiome(Biome biome) - { - return switch (biome) { - case NETHER_WASTES, SOUL_SAND_VALLEY, CRIMSON_FOREST, WARPED_FOREST, BASALT_DELTAS -> true; - default -> false; - }; + public static boolean isNetherBiome(Biome biome) { + return biome == Biome.NETHER_WASTES || biome == Biome.SOUL_SAND_VALLEY || biome == Biome.CRIMSON_FOREST + || biome == Biome.WARPED_FOREST || biome == Biome.BASALT_DELTAS; } @@ -516,12 +492,9 @@ public static boolean isNetherBiome(Biome biome) * @param biome Biome that must be checked. * @return {@code true} if I think it is the end biome, {@code false} otherwise. */ - public static boolean isTheEndBiome(Biome biome) - { - return switch (biome) { - case THE_END, SMALL_END_ISLANDS, END_MIDLANDS, END_HIGHLANDS, END_BARRENS -> true; - default -> false; - }; + public static boolean isTheEndBiome(Biome biome) { + return biome == Biome.THE_END || biome == Biome.SMALL_END_ISLANDS || biome == Biome.END_MIDLANDS + || biome == Biome.END_HIGHLANDS || biome == Biome.END_BARRENS; } @@ -633,7 +606,7 @@ public static String prettifyObject(Biome biome, User user) // biomes: // [biome]: // name: [name] - String translation = user.getTranslationOrNothing(Constants.BIOMES + biome.name().toLowerCase() + ".name"); + String translation = user.getTranslationOrNothing(Constants.BIOMES + biome.getKey().getKey() + ".name"); if (!translation.isEmpty()) { @@ -646,7 +619,7 @@ public static String prettifyObject(Biome biome, User user) // biomes: // [biome]: [name] - translation = user.getTranslationOrNothing(Constants.BIOMES + biome.name().toLowerCase()); + translation = user.getTranslationOrNothing(Constants.BIOMES + biome.getKey().getKey()); if (!translation.isEmpty()) { @@ -658,7 +631,7 @@ public static String prettifyObject(Biome biome, User user) // biomes: // [biome]: [name] - translation = user.getTranslationOrNothing("biomes." + biome.name().toLowerCase()); + translation = user.getTranslationOrNothing("biomes." + biome.getKey().getKey()); if (!translation.isEmpty()) { @@ -667,7 +640,7 @@ public static String prettifyObject(Biome biome, User user) } // Nothing was found. Use just a prettify text function. - return Util.prettifyText(biome.name()); + return Util.prettifyText(biome.getKey().getKey()); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 4c22d1d..2aff204 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,9 +1,9 @@ name: BentoBox-MagicCobblestoneGenerator main: world.bentobox.magiccobblestonegenerator.StoneGeneratorPladdon version: ${project.version}${build.number} -api-version: "1.18" +api-version: "1.21" -authors: [BONNe] +authors: [BONNe, tastybento] contributors: ["The BentoBoxWorld Community"] website: https://bentobox.world description: ${project.description}