From 14cd2b410510bdbb4d36d970d88af0ab5bce77e1 Mon Sep 17 00:00:00 2001 From: GeorgH93 Date: Mon, 9 Dec 2024 23:53:11 +0100 Subject: [PATCH] Add MC 1.21.3 and 1.21.4 support --- .../MarriageMaster/Bukkit/Database/Config.java | 12 +++++++++++- pom.xml | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bukkit/Database/Config.java b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bukkit/Database/Config.java index cf57d688..74ae0d30 100644 --- a/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bukkit/Database/Config.java +++ b/MarriageMaster/src/at/pcgamingfreaks/MarriageMaster/Bukkit/Database/Config.java @@ -30,6 +30,7 @@ import at.pcgamingfreaks.MarriageMaster.Database.DatabaseConfiguration; import at.pcgamingfreaks.MarriageMaster.MagicValues; import at.pcgamingfreaks.Message.MessageColor; +import at.pcgamingfreaks.Reflection; import at.pcgamingfreaks.Util.StringUtils; import at.pcgamingfreaks.Version; @@ -40,6 +41,7 @@ import org.jetbrains.annotations.Nullable; import java.io.FileNotFoundException; +import java.lang.reflect.Field; import java.util.*; import java.util.logging.Level; import java.util.stream.Collectors; @@ -709,7 +711,15 @@ private Sound getSound(final @NotNull String option, final @NotNull String autoV try { if (MCVersion.isNewerOrEqualThan(MCVersion.MC_1_9) && soundName.equals("ORB_PICKUP")) soundName = "ENTITY_EXPERIENCE_ORB_PICKUP"; - return Sound.valueOf(soundName); + if (MCVersion.isNewerOrEqualThan(MCVersion.MC_1_21)) + { + Field f = Reflection.getField(Sound.class, soundName); + if (f != null) return (Sound) f.get(null); + } + else + { + return Sound.valueOf(soundName); + } } catch(Exception ignored) { diff --git a/pom.xml b/pom.xml index dbe6608b..33e0e894 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ pom - 2.7.7 + 2.7.8 UTF-8 UTF-8 1.15.2-R0.1-SNAPSHOT 1.20-R0.2 - 1.0.39.7-SNAPSHOT + 1.0.39.8-SNAPSHOT 5.11.0 3.5.3