True if the player is connected through Geyser
*/ private boolean isGeyserPlayer(@NotNull Player player) { - try { - return GeyserApi.api().connectionByUuid(player.getUniqueId()) != null; - } catch (NoClassDefFoundError error) { + // Prevent unnecessary checking for non-geyser and floodgate servers + if (!hasGeyser && !hasFloodgate) { return false; } + + // Use Geyser API to get connection status + if (hasGeyser) { + try { + return GeyserApi.api().connectionByUuid(player.getUniqueId()) != null; + } catch (NoClassDefFoundError error1) { + hasGeyser = false; + } + } + + // Use Floodgate API to get connection status + if (hasFloodgate) { + try { + return FloodgateApi.getInstance().isFloodgatePlayer(player.getUniqueId()); + } catch (NoClassDefFoundError error2) { + hasFloodgate = false; + } + } + + return false; } /**