Add packet level checks for Geyser

If AuthType == ONLINE, players will be treated as if they were Java
players
If AuthType == OFFLINE, name conflicts will be checked the same way it's
done with Floodgate
Updated config.yml to infrom about the changes.
This commit is contained in:
Smart123s
2021-10-24 17:33:34 +02:00
committed by games647
parent d0a7832929
commit 2f61a8f8ad
2 changed files with 20 additions and 11 deletions

View File

@ -31,26 +31,34 @@ import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.shared.LoginSource;
import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.common.AuthType;
import org.geysermc.connector.network.session.GeyserSession;
public class GeyserService extends BedrockService<GeyserSession> {
private final GeyserConnector geyser;
private final FastLoginCore<?, ?, ?> core;
private final AuthType authType;
public GeyserService(GeyserConnector geyser, FastLoginCore<?, ?, ?> core) {
super(core);
this.geyser = geyser;
this.core = core;
this.authType = geyser.getConfig().getRemote().getAuthType();
}
@Override
public boolean performChecks(String username, LoginSource source) {
//TODO: Replace stub with Geyser specific code
if ("false".equals(allowConflict)) {
super.checkNameConflict(username, source);
} else {
// AuthType.FLOODGATE will be handled by FloodgateService
if (authType == AuthType.ONLINE) {
// authenticate everyone, as if they were Java players, since they have signed
// in through Mojang
return false;
}
if ("true".equals(allowConflict)) {
core.getPlugin().getLog().info("Skipping name conflict checking for player {}", username);
} else {
super.checkNameConflict(username, source);
}
return true;
}

View File

@ -205,8 +205,8 @@ autoLogin: true
# Enabling this might lead to people gaining unauthorized access to other's accounts!
autoLoginFloodgate: false
# This enables Floodgate players to join the server, even if autoRegister is true and there's an existing
# Java **PREMIUM** account with the same name
# This enables Floodgate or Offline Geyser players to join the server, even if they are using the name of an
# existing Java **PREMIUM** account (so someone has bought Minecraft with that username)
#
# Java and Bedrock players will get different UUIDs, so their inventories, location, etc. will be different.
# However, some plugins (such as AuthMe) rely on names instead of UUIDs to identify a player which might cause issues.
@ -219,12 +219,13 @@ autoLoginFloodgate: false
# A solution to this is to replace ProtocolLib with ProtocolSupport
#
# Possible values:
# false: Check for Premium Java name conflicts as described in 'autoRegister'
# Note: Linked players have the same name as their Java profile, so the Bedrock player will always conflict
# false: Kick Bedrock players, if they are using an existing Premium Java account's name
# Note: Linked Floodgate players have the same name as their Java profile, so the Bedrock player will always conflict
# their own Java account's name. Therefore, setting this to false will prevent any linked player from joining.
# true: Bypass 'autoRegister's name conflict checking
# linked: Bedrock accounts linked to a Java account will be allowed to join with conflicting names
# !!!!!!!! WARNING: FLOODGATE SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
# true: Bypass name conflict checking.
# linked: Floodgate accounts linked to a Java account will be allowed to join with conflicting names
# For Offline Geyser players, 'linked' works as 'false'
# !!!!!!!! WARNING: FLOODGATE/GEYSER SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
# Enabling this might lead to people gaining unauthorized access to other's accounts!
allowFloodgateNameConflict: false