Skip to content

Commit

Permalink
Only initialize NMSUtil#nmsVersionPackage when required (pre 1.17 ser…
Browse files Browse the repository at this point in the history
…vers)

Fixes support with Paper 1.20.5+ since they decided to not relocate CraftBukkit anymore.
Closes #78
  • Loading branch information
FlorianMichael committed May 2, 2024
1 parent b95e035 commit 560b84e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 560b84e

Please sign in to comment.