From 6a2f14ae39742f866fde60b46ef917ec961211ac Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Fri, 14 Jan 2022 19:38:51 +0100 Subject: [PATCH] Added utility methods in IOffPlayer and IOnlinePlayer interfaces --- .../java/fr/pandacube/lib/core/players/IOffPlayer.java | 4 ++++ .../fr/pandacube/lib/core/players/IOnlinePlayer.java | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/IOffPlayer.java b/Core/src/main/java/fr/pandacube/lib/core/players/IOffPlayer.java index 4df00dd..3cc2528 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/IOffPlayer.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/IOffPlayer.java @@ -70,6 +70,10 @@ public interface IOffPlayer { return v == 0 || v == 8; // also 8 if one day we supports alt accounts for floodgate players } + public default boolean isJavaAccount() { + return !isBedrockAccount(); + } + /* diff --git a/Core/src/main/java/fr/pandacube/lib/core/players/IOnlinePlayer.java b/Core/src/main/java/fr/pandacube/lib/core/players/IOnlinePlayer.java index ae6fbf1..ae1341c 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/players/IOnlinePlayer.java +++ b/Core/src/main/java/fr/pandacube/lib/core/players/IOnlinePlayer.java @@ -41,13 +41,21 @@ public interface IOnlinePlayer extends IOffPlayer { */ public default boolean isBedrockClient() { - return FloodgateApi.getInstance().isFloodgatePlayer(getUniqueId()); + try { + return FloodgateApi.getInstance().isFloodgatePlayer(getUniqueId()); + } catch (NoClassDefFoundError e) { + return false; + } } public default FloodgatePlayer getBedrockClient() { return FloodgateApi.getInstance().getPlayer(getUniqueId()); } + public default boolean isJavaClient() { + return !isBedrockClient(); + } +