Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<P> 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",
Expand Down Expand Up @@ -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());
}
Expand Down