diff --git a/pathetic-api/pom.xml b/pathetic-api/pom.xml index 543877a5..d7703163 100644 --- a/pathetic-api/pom.xml +++ b/pathetic-api/pom.xml @@ -13,11 +13,6 @@ pathetic-api 2.4.5 - - 8 - 8 - - org.spigotmc @@ -28,4 +23,4 @@ lombok - \ No newline at end of file + diff --git a/pathetic-mapping/pom.xml b/pathetic-mapping/pom.xml index ff1b0aeb..e700e180 100644 --- a/pathetic-mapping/pom.xml +++ b/pathetic-mapping/pom.xml @@ -12,11 +12,6 @@ pathetic-mapping 2.4.5 - - 8 - 8 - - diff --git a/pathetic-model/pom.xml b/pathetic-model/pom.xml index 978fb022..f10949e0 100644 --- a/pathetic-model/pom.xml +++ b/pathetic-model/pom.xml @@ -13,11 +13,6 @@ pathetic-model 2.4.5 - - 8 - 8 - - diff --git a/pathetic-model/src/main/java/org/patheloper/util/BukkitVersionUtil.java b/pathetic-model/src/main/java/org/patheloper/util/BukkitVersionUtil.java index 53d300de..661cff64 100644 --- a/pathetic-model/src/main/java/org/patheloper/util/BukkitVersionUtil.java +++ b/pathetic-model/src/main/java/org/patheloper/util/BukkitVersionUtil.java @@ -4,6 +4,9 @@ import lombok.experimental.UtilityClass; import org.bukkit.Bukkit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + @UtilityClass public class BukkitVersionUtil { @@ -11,9 +14,25 @@ public class BukkitVersionUtil { private static final double CURRENT_MINOR; static { - String[] versionParts = Bukkit.getBukkitVersion().split("-")[0].split("\\."); - CURRENT_MAJOR = Double.parseDouble(versionParts[1]); - CURRENT_MINOR = versionParts.length >= 3 ? Double.parseDouble(versionParts[2]) : 0; + Pattern pattern = Pattern.compile(".*\\(.*MC.\\s*([a-zA-z0-9\\-.]+)\\s*\\)"); + Matcher matcher = pattern.matcher(Bukkit.getVersion()); + + if (!matcher.matches() || matcher.group(1) == null) { + throw new IllegalStateException("Cannot parse version String '" + Bukkit.getVersion() + "'"); + } + + String[] elements = matcher.group(1).split("\\."); + if (elements.length < 1) { + throw new IllegalStateException("Invalid server version '" + matcher.group(1) + "'"); + } + + int[] values = new int[3]; + for (int i = 0; i < Math.min(values.length, elements.length); i++) { + values[i] = Integer.parseInt(elements[i].trim()); + } + + CURRENT_MAJOR = values[1]; + CURRENT_MINOR = values[2]; } public static Version getVersion() { diff --git a/pathetic-nms/paper/pom.xml b/pathetic-nms/paper/pom.xml index 57724d2a..4fd2f74b 100644 --- a/pathetic-nms/paper/pom.xml +++ b/pathetic-nms/paper/pom.xml @@ -12,12 +12,6 @@ paper - - 18 - 18 - UTF-8 - - papermc diff --git a/pathetic-nms/pom.xml b/pathetic-nms/pom.xml index 5701aca7..8cbab2a7 100644 --- a/pathetic-nms/pom.xml +++ b/pathetic-nms/pom.xml @@ -8,17 +8,12 @@ org.patheloper 2.4.5 + 4.0.0 pathetic-nms 2.4.5 - - 8 - 8 - UTF-8 - - org.slf4j diff --git a/pathetic-nms/v1_12/pom.xml b/pathetic-nms/v1_12/pom.xml index 7e7c11c4..9573798c 100644 --- a/pathetic-nms/v1_12/pom.xml +++ b/pathetic-nms/v1_12/pom.xml @@ -12,12 +12,6 @@ v1_12 - - 8 - 8 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_15/pom.xml b/pathetic-nms/v1_15/pom.xml index 071869e8..df4c7d94 100644 --- a/pathetic-nms/v1_15/pom.xml +++ b/pathetic-nms/v1_15/pom.xml @@ -12,12 +12,6 @@ v1_15 - - 8 - 8 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_16/pom.xml b/pathetic-nms/v1_16/pom.xml index 2bd4283e..9877032f 100644 --- a/pathetic-nms/v1_16/pom.xml +++ b/pathetic-nms/v1_16/pom.xml @@ -12,12 +12,6 @@ v1_16 - - 8 - 8 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_17/pom.xml b/pathetic-nms/v1_17/pom.xml index 063c05c7..1ab51ebc 100644 --- a/pathetic-nms/v1_17/pom.xml +++ b/pathetic-nms/v1_17/pom.xml @@ -12,12 +12,6 @@ v1_17 - - 8 - 8 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_18/pom.xml b/pathetic-nms/v1_18/pom.xml index c95cef6b..2d635607 100644 --- a/pathetic-nms/v1_18/pom.xml +++ b/pathetic-nms/v1_18/pom.xml @@ -12,12 +12,6 @@ v1_18 - - 16 - 16 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_18_R2/pom.xml b/pathetic-nms/v1_18_R2/pom.xml index 87bc7b09..2768530d 100644 --- a/pathetic-nms/v1_18_R2/pom.xml +++ b/pathetic-nms/v1_18_R2/pom.xml @@ -12,12 +12,6 @@ v1_18_R2 - - 16 - 16 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_19_R2/pom.xml b/pathetic-nms/v1_19_R2/pom.xml index 5e50e54a..50a447c3 100644 --- a/pathetic-nms/v1_19_R2/pom.xml +++ b/pathetic-nms/v1_19_R2/pom.xml @@ -12,12 +12,6 @@ v1_19_R2 - - 17 - 17 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_19_R3/pom.xml b/pathetic-nms/v1_19_R3/pom.xml index d7d55f12..bd1f41fe 100644 --- a/pathetic-nms/v1_19_R3/pom.xml +++ b/pathetic-nms/v1_19_R3/pom.xml @@ -12,12 +12,6 @@ v1_19_R3 - - 17 - 17 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_20_R1/pom.xml b/pathetic-nms/v1_20_R1/pom.xml index 9e1084b9..60559515 100644 --- a/pathetic-nms/v1_20_R1/pom.xml +++ b/pathetic-nms/v1_20_R1/pom.xml @@ -12,12 +12,6 @@ v1_20_R1 - - 17 - 17 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_20_R2/pom.xml b/pathetic-nms/v1_20_R2/pom.xml index ed1b0f7e..c19d6d09 100644 --- a/pathetic-nms/v1_20_R2/pom.xml +++ b/pathetic-nms/v1_20_R2/pom.xml @@ -12,12 +12,6 @@ v1_20_R2 - - 17 - 17 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_20_R3/pom.xml b/pathetic-nms/v1_20_R3/pom.xml index b0e5c13e..55373f14 100644 --- a/pathetic-nms/v1_20_R3/pom.xml +++ b/pathetic-nms/v1_20_R3/pom.xml @@ -12,12 +12,6 @@ v1_20_R3 - - 17 - 17 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_20_R4/pom.xml b/pathetic-nms/v1_20_R4/pom.xml index b922cd2d..ae8eaeed 100644 --- a/pathetic-nms/v1_20_R4/pom.xml +++ b/pathetic-nms/v1_20_R4/pom.xml @@ -12,12 +12,6 @@ v1_20_R4 - - 21 - 21 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_21/pom.xml b/pathetic-nms/v1_21/pom.xml index a3f3f745..76d6dd59 100644 --- a/pathetic-nms/v1_21/pom.xml +++ b/pathetic-nms/v1_21/pom.xml @@ -12,12 +12,6 @@ v1_21 - - 21 - 21 - UTF-8 - - codemc-repo diff --git a/pathetic-nms/v1_8/pom.xml b/pathetic-nms/v1_8/pom.xml index 7f4c637c..df2a6c9e 100644 --- a/pathetic-nms/v1_8/pom.xml +++ b/pathetic-nms/v1_8/pom.xml @@ -12,12 +12,6 @@ v1_8 - - 8 - 8 - UTF-8 - - codemc-repo diff --git a/pom.xml b/pom.xml index 81f9c6b1..191672ff 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,7 @@ 8 8 + UTF-8