Only initialize NMSUtil#nmsVersionPackage when required (pre 1.17 servers)

Fixes support with Paper 1.20.5+ since they decided to not relocate CraftBukkit anymore.
Closes https://github.com/ViaVersion/ViaRewind-Legacy-Support/issues/78
This commit is contained in:
FlorianMichael 2024-05-02 23:35:28 +02:00
parent b95e03512e
commit 560b84e3f5
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
1 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,9 @@ public class NMSUtil {
private static Field playerConnectionField;
static {
nmsVersionPackage = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
if (BukkitPlugin.getInstance().getServerProtocol().olderThan(ProtocolVersion.v1_17)) {
nmsVersionPackage = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
}
}
public static Class<?> getBlockPositionClass() {