Support for latest Leaves

This commit is contained in:
DGun Otto 2024-05-31 02:24:22 +08:00 committed by GitHub
parent 2fe0da569b
commit 18ab6623ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,7 +10,7 @@ public final class PlayerUtils {
// Utility class
private PlayerUtils() {
}
private static final boolean IS_LEAVES_SERVER = Utils.isClassLoaded("top.leavesmc.leaves.LeavesConfig");
private static final boolean isLeavesServer = Utils.isClassLoaded("top.leavesmc.leaves.LeavesConfig") || Utils.isClassLoaded("org.leavesmc.leaves.LeavesConfig");
/**
* Returns the IP of the given player.
@ -29,7 +29,7 @@ public final class PlayerUtils {
* @return True if the player is an NPC, false otherwise
*/
public static boolean isNpc(Player player) {
if (IS_LEAVES_SERVER) {
if (isLeavesServer) {
return player.hasMetadata("NPC") || player.getAddress() == null;
} else {
return player.hasMetadata("NPC");