From 070f1adee7b3245fb8e1e3edc2c57fd7ad5330ba Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Fri, 10 Dec 2021 19:35:30 +0100 Subject: [PATCH] Fixes `CompatibleBiome#isCompatible` and `#getBiome` `#isCompatible` always returned true and `#getBiome` could result in an Exception because of biomes not having any version information configured (silencing it should not be the way to go but Minecraft 1.18 updates \o/) --- .../core/compatibility/CompatibleBiome.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleBiome.java b/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleBiome.java index c49797c2..bf1b484a 100644 --- a/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleBiome.java +++ b/Compatibility/src/main/java/com/songoda/core/compatibility/CompatibleBiome.java @@ -170,10 +170,7 @@ public enum CompatibleBiome { } public boolean isCompatible() { - Version version = versions.getLast(); - ServerVersion.isServerVersionAtLeast(version.version); - - return true; + return getBiome() != null; } public List getVersions() { @@ -181,10 +178,13 @@ public enum CompatibleBiome { } public Biome getBiome() { - for (Version version : versions) { - if (ServerVersion.isServerVersionAtLeast(version.version)) { - return Biome.valueOf(version.biome); + try { + for (Version version : versions) { + if (ServerVersion.isServerVersionAtLeast(version.version)) { + return Biome.valueOf(version.biome); + } } + } catch (IllegalArgumentException ignore) { // This means the supporter biome server version is wrongly configured } return null;