From e1c172cded94eebdcb311729a1a220e6a0f861dc Mon Sep 17 00:00:00 2001 From: Intybyte Date: Wed, 25 Sep 2024 18:37:46 +0200 Subject: [PATCH] Use slimefun version and add 1_21 --- .../thebusybiscuit/slimefun4/api/MinecraftVersion.java | 6 ++++++ .../slimefun4/implementation/items/tools/ExplosiveTool.java | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java index 4fc0160ac6..7a408e83fc 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java @@ -55,6 +55,12 @@ public enum MinecraftVersion { */ MINECRAFT_1_20_5(20, 5, "1.20.5+"), + /** + * This constant represents Minecraft (Java Edition) Version 1.21 + * ("Tricky Trials") + */ + MINECRAFT_1_21(21, 0, "1.21+"), + /** * This constant represents an exceptional state in which we were unable * to identify the Minecraft Version we are using diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java index dbd8f34a4d..58e3c676f5 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/tools/ExplosiveTool.java @@ -9,6 +9,7 @@ import javax.annotation.ParametersAreNonnullByDefault; import dev.lone.itemsadder.api.CustomBlock; +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.ExplosionResult; @@ -194,9 +195,9 @@ private BlockExplodeEvent createNewBlockExplodeEvent( List blocks, float yield ) { - String[] version = Bukkit.getBukkitVersion().split("-"); - if (Integer.parseInt(version[1]) >= 21) { + var version = Slimefun.getMinecraftVersion(); + if (version.isAtLeast(MinecraftVersion.MINECRAFT_1_21)) { return new BlockExplodeEvent(block, block.getState(), blocks, yield, ExplosionResult.DESTROY); } else { try {