From 19557e6f999464f0f842e7624e8f862b3d1bd947 Mon Sep 17 00:00:00 2001 From: TylerS1066 Date: Thu, 20 Jun 2024 14:51:13 -0500 Subject: [PATCH] Fix version parsing --- .../main/java/net/countercraft/movecraft/WorldHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/net/countercraft/movecraft/WorldHandler.java b/api/src/main/java/net/countercraft/movecraft/WorldHandler.java index 67579b1b1..bbf829daf 100644 --- a/api/src/main/java/net/countercraft/movecraft/WorldHandler.java +++ b/api/src/main/java/net/countercraft/movecraft/WorldHandler.java @@ -19,6 +19,9 @@ public abstract class WorldHandler { public abstract void setAccessLocation(@NotNull InventoryView inventoryView, @NotNull Location location); public static @NotNull String getPackageName(@NotNull String minecraftVersion) { - return "v1_" + minecraftVersion.substring(minecraftVersion.indexOf('.') + 1, minecraftVersion.lastIndexOf('.')); + String[] parts = minecraftVersion.split("\\."); + if (parts.length < 2) + throw new IllegalArgumentException(); + return "v1_" + parts[1]; } }