From 52ec695d9d74917a237ff5a8d73ec96675a62935 Mon Sep 17 00:00:00 2001 From: TylerS1066 Date: Thu, 20 Jun 2024 13:01:40 -0500 Subject: [PATCH] Change version check --- .../movecraft/compat/v1_18/IWorldHandler.java | 15 +++++---------- .../movecraft/compat/v1_20/IWorldHandler.java | 14 +++++--------- .../movecraft/compat/v1_21/IWorldHandler.java | 14 +++++--------- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/v1_18/src/main/java/net/countercraft/movecraft/compat/v1_18/IWorldHandler.java b/v1_18/src/main/java/net/countercraft/movecraft/compat/v1_18/IWorldHandler.java index 577b9f81a..4db751f85 100644 --- a/v1_18/src/main/java/net/countercraft/movecraft/compat/v1_18/IWorldHandler.java +++ b/v1_18/src/main/java/net/countercraft/movecraft/compat/v1_18/IWorldHandler.java @@ -21,23 +21,18 @@ import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.ticks.LevelChunkTicks; import net.minecraft.world.ticks.ScheduledTick; +import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.v1_18_R2.CraftWorld; import org.bukkit.craftbukkit.v1_18_R2.block.data.CraftBlockData; import org.bukkit.craftbukkit.v1_18_R2.inventory.CraftInventoryView; -import org.bukkit.craftbukkit.v1_18_R2.util.CraftMagicNumbers; import org.bukkit.inventory.InventoryView; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.Predicate; @SuppressWarnings("unused") @@ -54,9 +49,9 @@ public class IWorldHandler extends WorldHandler { private final NextTickProvider tickProvider = new NextTickProvider(); public IWorldHandler() { - String mappings = ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion(); - if (!mappings.equals("eaeedbff51b16ead3170906872fda334")) - throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft 1.18: " + mappings); + String version = Bukkit.getServer().getMinecraftVersion(); + if (!version.equals("1.18.2")) + throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft: " + version); } @Override diff --git a/v1_20/src/main/java/net/countercraft/movecraft/compat/v1_20/IWorldHandler.java b/v1_20/src/main/java/net/countercraft/movecraft/compat/v1_20/IWorldHandler.java index 333f73f72..019dd0ba8 100644 --- a/v1_20/src/main/java/net/countercraft/movecraft/compat/v1_20/IWorldHandler.java +++ b/v1_20/src/main/java/net/countercraft/movecraft/compat/v1_20/IWorldHandler.java @@ -20,22 +20,18 @@ import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.ticks.ScheduledTick; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.inventory.CraftInventoryView; -import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.inventory.InventoryView; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @SuppressWarnings("unused") public class IWorldHandler extends WorldHandler { @@ -51,9 +47,9 @@ public class IWorldHandler extends WorldHandler { private final NextTickProvider tickProvider = new NextTickProvider(); public IWorldHandler() { - String mappings = ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion(); - if (!mappings.equals("ee13f98a43b9c5abffdcc0bb24154460")) - throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft 1.20: " + mappings); + String version = Bukkit.getServer().getMinecraftVersion(); + if (!version.equals("1.20.6")) + throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft: " + version); } @Override diff --git a/v1_21/src/main/java/net/countercraft/movecraft/compat/v1_21/IWorldHandler.java b/v1_21/src/main/java/net/countercraft/movecraft/compat/v1_21/IWorldHandler.java index 722f1e027..e2ed2fc0d 100644 --- a/v1_21/src/main/java/net/countercraft/movecraft/compat/v1_21/IWorldHandler.java +++ b/v1_21/src/main/java/net/countercraft/movecraft/compat/v1_21/IWorldHandler.java @@ -20,22 +20,18 @@ import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.LevelChunkSection; import net.minecraft.world.ticks.ScheduledTick; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.inventory.CraftInventoryView; -import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.inventory.InventoryView; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @SuppressWarnings("unused") public class IWorldHandler extends WorldHandler { @@ -51,9 +47,9 @@ public class IWorldHandler extends WorldHandler { private final NextTickProvider tickProvider = new NextTickProvider(); public IWorldHandler() { - String mappings = ((CraftMagicNumbers) CraftMagicNumbers.INSTANCE).getMappingsVersion(); - if (!mappings.equals("ee13f98a43b9c5abffdcc0bb24154460")) - throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft 1.10: " + mappings); + String version = Bukkit.getServer().getMinecraftVersion(); + if (!version.equals("1.21")) + throw new IllegalStateException("Movecraft is not compatible with this version of Minecraft: " + version); } @Override