From a93f0546e37bf172d94e72577441d99e5aee7d28 Mon Sep 17 00:00:00 2001 From: HaHaWTH Date: Thu, 28 Mar 2024 07:39:29 +0800 Subject: [PATCH] Leaves compatibility --- src/main/java/fr/xephi/authme/util/PlayerUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/util/PlayerUtils.java b/src/main/java/fr/xephi/authme/util/PlayerUtils.java index 800993e8..d9b867d7 100644 --- a/src/main/java/fr/xephi/authme/util/PlayerUtils.java +++ b/src/main/java/fr/xephi/authme/util/PlayerUtils.java @@ -10,6 +10,7 @@ public final class PlayerUtils { // Utility class private PlayerUtils() { } + private static final boolean IS_LEAVES_SERVER = Utils.isClassLoaded("top.leavesmc.leaves.LeavesConfig"); /** * Returns the IP of the given player. @@ -28,7 +29,11 @@ public final class PlayerUtils { * @return True if the player is an NPC, false otherwise */ public static boolean isNpc(Player player) { - return player.hasMetadata("NPC") || player.getAddress() == null; + if (IS_LEAVES_SERVER) { + return player.hasMetadata("NPC") || player.getAddress() == null; + } else { + return player.hasMetadata("NPC"); + } } }