Skip to content

Commit

Permalink
Use slimefun version and add 1_21
Browse files Browse the repository at this point in the history
  • Loading branch information
Intybyte committed Sep 25, 2024
1 parent 5f49740 commit e1c172c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -194,9 +195,9 @@ private BlockExplodeEvent createNewBlockExplodeEvent(
List<Block> 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 {
Expand Down

0 comments on commit e1c172c

Please sign in to comment.