From 7706b2c535d42396b0b5ec231d05d69aa21204cc Mon Sep 17 00:00:00 2001 From: StarWishsama Date: Tue, 16 Jul 2024 11:22:47 +0800 Subject: [PATCH] fix(mc): fix minecraft version identify --- .../slimefun4/api/MinecraftVersion.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 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 ae192b888f..a2afdd5c1f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/MinecraftVersion.java @@ -174,9 +174,19 @@ public boolean isMinecraftVersion(int minecraftVersion) { * @return Whether this {@link MinecraftVersion} matches the specified version id */ public boolean isMinecraftVersion(int minecraftVersion, int patchVersion) { - return !isVirtual() - && this.majorVersion == minecraftVersion - && (this.minorVersion >= patchVersion || (this.majorVersion != 20 && this.minorVersion == -1)); + if (isVirtual()) { + return false; + } + + if (this.majorVersion != minecraftVersion) { + return false; + } + + if (this.majorVersion == 20) { + return this.minorVersion >= patchVersion; + } else { + return this.minorVersion == -1 || this.minorVersion >= patchVersion; + } } /**