forked from TuxCoding/FastLogin
Do not silence exceptions for Floodgate
This commit is contained in:
@ -25,6 +25,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.github.games647.fastlogin.core.shared;
|
package com.github.games647.fastlogin.core.shared;
|
||||||
|
|
||||||
|
import com.github.games647.craftapi.model.Profile;
|
||||||
|
import com.github.games647.craftapi.resolver.RateLimitException;
|
||||||
|
import com.github.games647.fastlogin.core.StoredProfile;
|
||||||
|
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
@ -32,11 +37,6 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
import org.geysermc.floodgate.api.player.FloodgatePlayer;
|
||||||
|
|
||||||
import com.github.games647.craftapi.model.Profile;
|
|
||||||
import com.github.games647.craftapi.resolver.RateLimitException;
|
|
||||||
import com.github.games647.fastlogin.core.StoredProfile;
|
|
||||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
|
||||||
|
|
||||||
public abstract class FloodgateManagement<P extends C, C, L extends LoginSession, T extends PlatformPlugin<C>>
|
public abstract class FloodgateManagement<P extends C, C, L extends LoginSession, T extends PlatformPlugin<C>>
|
||||||
implements Runnable {
|
implements Runnable {
|
||||||
|
|
||||||
@ -69,9 +69,7 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
core.getPlugin().getLog().info(
|
core.getPlugin().getLog().info("Player {} is connecting through Geyser Floodgate.", username);
|
||||||
"Player {} is connecting through Geyser Floodgate.",
|
|
||||||
username);
|
|
||||||
|
|
||||||
// check if the Bedrock player is linked to a Java account
|
// check if the Bedrock player is linked to a Java account
|
||||||
isLinked = floodgatePlayer.getLinkedPlayer() != null;
|
isLinked = floodgatePlayer.getLinkedPlayer() != null;
|
||||||
@ -79,10 +77,10 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
isRegistered = authPlugin.isRegistered(username);
|
isRegistered = authPlugin.isRegistered(username);
|
||||||
} catch (Exception e) {
|
} catch (Exception ex) {
|
||||||
core.getPlugin().getLog().error(
|
core.getPlugin().getLog().error(
|
||||||
"An error has occured while checking if player {} is registered",
|
"An error has occured while checking if player {} is registered",
|
||||||
username);
|
username, ex);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,8 +92,8 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
|||||||
premiumUUID = core.getResolver().findProfile(username);
|
premiumUUID = core.getResolver().findProfile(username);
|
||||||
} catch (IOException | RateLimitException e) {
|
} catch (IOException | RateLimitException e) {
|
||||||
core.getPlugin().getLog().error(
|
core.getPlugin().getLog().error(
|
||||||
"Could not check wether Floodgate Player {}'s name conflits a premium Java account's name.",
|
"Could not check whether Floodgate Player {}'s name conflicts a premium Java account's name.",
|
||||||
username);
|
username, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,9 +124,9 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
|||||||
* @return true if the Player can be registered automatically
|
* @return true if the Player can be registered automatically
|
||||||
*/
|
*/
|
||||||
private boolean isAutoRegisterAllowed() {
|
private boolean isAutoRegisterAllowed() {
|
||||||
return autoRegisterFloodgate.equals("true")
|
return "true".equals(autoRegisterFloodgate)
|
||||||
|| autoRegisterFloodgate.equals("no-conflict") // this was checked before
|
|| "no-conflict".equals(autoRegisterFloodgate) // this was checked before
|
||||||
|| (autoRegisterFloodgate.equals("linked") && isLinked);
|
|| ("linked".equals(autoRegisterFloodgate) && isLinked);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -140,16 +138,16 @@ public abstract class FloodgateManagement<P extends C, C, L extends LoginSession
|
|||||||
//OR
|
//OR
|
||||||
//if allowNameConflict is 'false' or 'linked' and the player had a conflicting
|
//if allowNameConflict is 'false' or 'linked' and the player had a conflicting
|
||||||
//name, than they would have been kicked in FloodgateHook#checkNameConflict
|
//name, than they would have been kicked in FloodgateHook#checkNameConflict
|
||||||
if (isLinked || !allowNameConflict.equals("true")) {
|
if (isLinked || !"true".equals(allowNameConflict)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//autoRegisterFloodgate should only be checked if then player is not yet registered
|
//autoRegisterFloodgate should only be checked if then player is not yet registered
|
||||||
if (!isRegistered && autoRegisterFloodgate.equals("no-conflict")) {
|
if (!isRegistered && "no-conflict".equals(autoRegisterFloodgate)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoLoginFloodgate.equals("no-conflict");
|
return "no-conflict".equals(autoLoginFloodgate);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void startLogin();
|
protected abstract void startLogin();
|
||||||
|
Reference in New Issue
Block a user