From 198e8f9ea2add870bfdb3754dca26a71299abf6f Mon Sep 17 00:00:00 2001 From: Smart123s <28480228+Smart123s@users.noreply.github.com> Date: Sun, 15 Aug 2021 17:23:47 +0200 Subject: [PATCH 1/2] Fix Floodgate without auth plugin If no auth plugin is installed, rely on StoredProfile This fixes #594 --- .../core/shared/FloodgateManagement.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FloodgateManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FloodgateManagement.java index 92cae6658..3b36c3ea8 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FloodgateManagement.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FloodgateManagement.java @@ -73,10 +73,20 @@ public void run() { // check if the Bedrock player is linked to a Java account isLinked = floodgatePlayer.getLinkedPlayer() != null; + profile = core.getStorage().loadProfile(username); AuthPlugin

authPlugin = core.getAuthPluginHook(); - + try { - isRegistered = authPlugin.isRegistered(username); + //maybe Bungee without auth plugin + if (authPlugin == null) { + if (profile != null) { + isRegistered = profile.isPremium(); + } else { + isRegistered = false; + } + } else { + isRegistered = authPlugin.isRegistered(username); + } } catch (Exception ex) { core.getPlugin().getLog().error( "An error has occured while checking if player {} is registered", @@ -108,7 +118,6 @@ public void run() { } //logging in from bedrock for a second time threw an error with UUID - profile = core.getStorage().loadProfile(username); if (profile == null) { profile = new StoredProfile(getUUID(player), username, true, getAddress(player).toString()); } From 056b8a7af7be09913c3fbb893c6299590c46706e Mon Sep 17 00:00:00 2001 From: Smart123s <28480228+Smart123s@users.noreply.github.com> Date: Sun, 15 Aug 2021 17:29:11 +0200 Subject: [PATCH 2/2] Recieve success message for Floodgate Floodgate players are offline players, so a special check needs to be done to save Floodgate players as if they were online players. --- .../bungee/listener/PluginMessageListener.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PluginMessageListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PluginMessageListener.java index 3b2e8f0e2..5099785c6 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PluginMessageListener.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PluginMessageListener.java @@ -36,6 +36,9 @@ import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; +import org.geysermc.floodgate.api.FloodgateApi; +import org.geysermc.floodgate.api.player.FloodgatePlayer; + import java.util.Arrays; import net.md_5.bungee.api.CommandSender; @@ -115,7 +118,13 @@ private void readMessage(ProxiedPlayer forPlayer, String channel, byte[] data) { } private void onSuccessMessage(ProxiedPlayer forPlayer) { - if (forPlayer.getPendingConnection().isOnlineMode()) { + //check if player is using Floodgate + FloodgatePlayer floodgatePlayer = null; + if (plugin.isPluginInstalled("floodgate")) { + floodgatePlayer = FloodgateApi.getInstance().getPlayer(forPlayer.getUniqueId()); + } + + if (forPlayer.getPendingConnection().isOnlineMode() || floodgatePlayer != null){ //bukkit module successfully received and force logged in the user //update only on success to prevent corrupt data BungeeLoginSession loginSession = plugin.getSession().get(forPlayer.getPendingConnection());