Skip to content

Commit 5cb4f34

Browse files
committed
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.
1 parent a23b372 commit 5cb4f34

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/GeyserService.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,34 @@
3131
import com.github.games647.fastlogin.core.shared.LoginSource;
3232

3333
import org.geysermc.connector.GeyserConnector;
34+
import org.geysermc.connector.common.AuthType;
3435
import org.geysermc.connector.network.session.GeyserSession;
3536

3637
public class GeyserService extends BedrockService<GeyserSession> {
3738

3839
private final GeyserConnector geyser;
3940
private final FastLoginCore<?, ?, ?> core;
41+
private final AuthType authType;
4042

4143
public GeyserService(GeyserConnector geyser, FastLoginCore<?, ?, ?> core) {
4244
super(core);
4345
this.geyser = geyser;
4446
this.core = core;
47+
this.authType = geyser.getConfig().getRemote().getAuthType();
4548
}
4649

4750
@Override
4851
public boolean performChecks(String username, LoginSource source) {
49-
//TODO: Replace stub with Geyser specific code
50-
if ("false".equals(allowConflict)) {
51-
super.checkNameConflict(username, source);
52-
} else {
52+
// AuthType.FLOODGATE will be handled by FloodgateService
53+
if (authType == AuthType.ONLINE) {
54+
// authenticate everyone, as if they were Java players, since they have signed
55+
// in through Mojang
56+
return false;
57+
}
58+
if ("true".equals(allowConflict)) {
5359
core.getPlugin().getLog().info("Skipping name conflict checking for player {}", username);
60+
} else {
61+
super.checkNameConflict(username, source);
5462
}
5563
return true;
5664
}

core/src/main/resources/config.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ autoLogin: true
205205
# Enabling this might lead to people gaining unauthorized access to other's accounts!
206206
autoLoginFloodgate: false
207207

208-
# This enables Floodgate players to join the server, even if autoRegister is true and there's an existing
209-
# Java **PREMIUM** account with the same name
208+
# This enables Floodgate or Offline Geyser players to join the server, even if they are using the name of an
209+
# existing Java **PREMIUM** account (so someone has bought Minecraft with that username)
210210
#
211211
# Java and Bedrock players will get different UUIDs, so their inventories, location, etc. will be different.
212212
# 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
219219
# A solution to this is to replace ProtocolLib with ProtocolSupport
220220
#
221221
# Possible values:
222-
# false: Check for Premium Java name conflicts as described in 'autoRegister'
223-
# Note: Linked players have the same name as their Java profile, so the Bedrock player will always conflict
222+
# false: Kick Bedrock players, if they are using an existing Premium Java account's name
223+
# Note: Linked Floodgate players have the same name as their Java profile, so the Bedrock player will always conflict
224224
# their own Java account's name. Therefore, setting this to false will prevent any linked player from joining.
225-
# true: Bypass 'autoRegister's name conflict checking
226-
# linked: Bedrock accounts linked to a Java account will be allowed to join with conflicting names
227-
# !!!!!!!! WARNING: FLOODGATE SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
225+
# true: Bypass name conflict checking.
226+
# linked: Floodgate accounts linked to a Java account will be allowed to join with conflicting names
227+
# For Offline Geyser players, 'linked' works as 'false'
228+
# !!!!!!!! WARNING: FLOODGATE/GEYSER SUPPORT IS AN EXPERIMENTAL FEATURE !!!!!!!!
228229
# Enabling this might lead to people gaining unauthorized access to other's accounts!
229230
allowFloodgateNameConflict: false
230231

0 commit comments

Comments
 (0)