diff --git a/pom.xml b/pom.xml index c6fc464..db723b2 100644 --- a/pom.xml +++ b/pom.xml @@ -53,9 +53,9 @@ - com.github.retrooper.packetevents - spigot - 2.3.0 + com.github.retrooper + packetevents-spigot + 2.4.0 provided @@ -73,7 +73,7 @@ org.projectlombok lombok - 1.18.26 + 1.18.30 jar provided @@ -120,7 +120,7 @@ org.projectlombok lombok - 1.18.20 + 1.18.30 ${maven.compiler.target} diff --git a/src/main/java/xyz/refinedev/api/tablist/util/StringUtils.java b/src/main/java/xyz/refinedev/api/tablist/util/StringUtils.java index 4e5900a..50fde6f 100644 --- a/src/main/java/xyz/refinedev/api/tablist/util/StringUtils.java +++ b/src/main/java/xyz/refinedev/api/tablist/util/StringUtils.java @@ -25,10 +25,19 @@ @UtilityClass public class StringUtils { - public static final String VERSION = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; - public static final int MINOR_VERSION = Integer.parseInt(VERSION.split("_")[1]); + public static final int MINOR_VERSION; private static final Pattern hexPattern = Pattern.compile("&#[A-Fa-f0-9]{6}"); + static { + Matcher matcher = Pattern.compile("MC: \\d\\.(\\d+)").matcher(Bukkit.getVersion()); + + if (matcher.find()) { + MINOR_VERSION = Integer.parseInt(matcher.group(1)); + }else { + MINOR_VERSION = 8; + } + } + // Thnx scifi, love you <3