mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-07-30 10:47:33 +02:00
Detect if a player is connecting through Floodgate
The Floodgate API requires UUID which is inaccessible at the level FastLogion operates on. A workaround for this is to check if the currently connecting player is also a part of the Geyser server's online players list. *TODO: Check for Java and Bedrock name conflicts with multiple configurations.*
This commit is contained in:
@ -98,6 +98,12 @@
|
|||||||
<enabled>false</enabled>
|
<enabled>false</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
<!-- Floodgate -->
|
||||||
|
<repository>
|
||||||
|
<id>nukkitx-snapshot</id>
|
||||||
|
<url>https://repo.nukkitx.com/maven-snapshots/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -213,6 +219,13 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.geysermc</groupId>
|
||||||
|
<artifactId>connector</artifactId>
|
||||||
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!--No maven repository :(-->
|
<!--No maven repository :(-->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -12,6 +12,9 @@ import java.security.KeyPair;
|
|||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.geysermc.connector.GeyserConnector;
|
||||||
|
import org.geysermc.connector.common.AuthType;
|
||||||
|
import org.geysermc.connector.network.session.GeyserSession;
|
||||||
|
|
||||||
import static com.comphenix.protocol.PacketType.Login.Client.ENCRYPTION_BEGIN;
|
import static com.comphenix.protocol.PacketType.Login.Client.ENCRYPTION_BEGIN;
|
||||||
import static com.comphenix.protocol.PacketType.Login.Client.START;
|
import static com.comphenix.protocol.PacketType.Login.Client.START;
|
||||||
@ -87,6 +90,21 @@ public class ProtocolLibListener extends PacketAdapter {
|
|||||||
String username = packet.getGameProfiles().read(0).getName();
|
String username = packet.getGameProfiles().read(0).getName();
|
||||||
plugin.getLog().trace("GameProfile {} with {} connecting", sessionKey, username);
|
plugin.getLog().trace("GameProfile {} with {} connecting", sessionKey, username);
|
||||||
|
|
||||||
|
// check if the player is connecting through Geyser
|
||||||
|
if (GeyserConnector.getInstance().getDefaultAuthType() == AuthType.FLOODGATE) {
|
||||||
|
// the Floodgate API requires UUID, which is inaccessible at this state
|
||||||
|
// workaround: iterate over Geyser's player's usernames
|
||||||
|
for (GeyserSession geyserPlayer : GeyserConnector.getInstance().getPlayers()) {
|
||||||
|
if (geyserPlayer.getName().equals(username)) {
|
||||||
|
plugin.getLog().info(
|
||||||
|
"Player {} is connecting throught Geyser Floodgate. FastLogin will not check this player.",
|
||||||
|
username);
|
||||||
|
// TODO: auto login (WHEN?)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
packetEvent.getAsyncMarker().incrementProcessingDelay();
|
packetEvent.getAsyncMarker().incrementProcessingDelay();
|
||||||
Runnable nameCheckTask = new NameCheckTask(plugin, packetEvent, random, player, username, keyPair.getPublic());
|
Runnable nameCheckTask = new NameCheckTask(plugin, packetEvent, random, player, username, keyPair.getPublic());
|
||||||
plugin.getScheduler().runAsync(nameCheckTask);
|
plugin.getScheduler().runAsync(nameCheckTask);
|
||||||
|
Reference in New Issue
Block a user