diff --git a/bukkit/pom.xml b/bukkit/pom.xml index fbd469303..f7d4d7a89 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -124,7 +124,7 @@ - dmulloy2-repo + dmulloy2-public https://repo.dmulloy2.net/repository/public/ @@ -206,9 +206,9 @@ - com.comphenix.protocol + net.dmulloy2 ProtocolLib - 5.3.0 + 5.5.0-SNAPSHOT provided diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java index 0ad09b952..3f3f386bb 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java @@ -49,7 +49,7 @@ import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; import org.geysermc.floodgate.api.FloodgateApi; -import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.GeyserApi; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; @@ -161,7 +161,7 @@ private void registerCommands() { private boolean initializeFloodgate() { if (getServer().getPluginManager().getPlugin("Geyser-Spigot") != null) { - geyserService = new GeyserService(GeyserImpl.getInstance(), core); + geyserService = new GeyserService(GeyserApi.api(), core); } if (getServer().getPluginManager().getPlugin("floodgate") != null) { diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java index 770b36bd7..51d1e6ad0 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java @@ -54,7 +54,7 @@ import net.md_5.bungee.api.plugin.PluginManager; import net.md_5.bungee.api.scheduler.GroupedThreadFactory; import org.geysermc.floodgate.api.FloodgateApi; -import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.GeyserApi; import org.slf4j.Logger; import java.nio.file.Path; @@ -92,7 +92,7 @@ public void onEnable() { } if (isPluginInstalled("Geyser-BungeeCord")) { - geyserService = new GeyserService(GeyserImpl.getInstance(), core); + geyserService = new GeyserService(GeyserApi.api(), core); } //events diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/BedrockService.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/BedrockService.java index 805b181d2..768e0925c 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/BedrockService.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/BedrockService.java @@ -35,10 +35,7 @@ import java.util.Optional; import java.util.UUID; -/** - * @param is an instance of either FloodgatePlayer or GeyserSession - */ -public abstract class BedrockService { +public abstract class BedrockService { protected final FastLoginCore core; protected final String allowConflict; @@ -107,11 +104,11 @@ private void kickPlayer(LoginSource source, String username, String message) { * @param prefixedUsername the name of the player with the prefix appended * @return Bedrock Player if found, null otherwise */ - public B getBedrockPlayer(String prefixedUsername) { + public GeyserConnection getBedrockPlayer(String prefixedUsername) { return null; } - public B getBedrockPlayer(UUID uuid) { + public GeyserConnection getBedrockPlayer(UUID uuid) { return null; } diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/GeyserService.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/GeyserService.java index 0e4217a3e..0a8ccc8a9 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/GeyserService.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/hooks/bedrock/GeyserService.java @@ -27,33 +27,33 @@ import com.github.games647.fastlogin.core.shared.FastLoginCore; import com.github.games647.fastlogin.core.shared.LoginSource; -import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.GeyserApi; +import org.geysermc.geyser.api.connection.GeyserConnection; import org.geysermc.geyser.api.network.AuthType; -import org.geysermc.geyser.session.GeyserSession; import java.util.UUID; -public class GeyserService extends BedrockService { +public class GeyserService extends BedrockService { - private final GeyserImpl geyser; + private final GeyserApi geyser; private final FastLoginCore core; - private final AuthType authType; - public GeyserService(GeyserImpl geyser, FastLoginCore core) { + public GeyserService(GeyserApi geyser, FastLoginCore core) { super(core); this.geyser = geyser; this.core = core; - this.authType = GeyserImpl.getInstance().getConfig().getRemote().authType(); } @Override public boolean performChecks(String username, LoginSource source) { // AuthType.FLOODGATE will be handled by FloodgateService + AuthType authType = geyser.defaultRemoteServer().authType(); 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 { @@ -63,17 +63,17 @@ public boolean performChecks(String username, LoginSource source) { } @Override - public GeyserSession getBedrockPlayer(String username) { - for (GeyserSession gSess : geyser.getSessionManager().getAllSessions()) { - if (username.equals(gSess.getClientData().getUsername())) { - return gSess; + public GeyserConnection getBedrockPlayer(String username) { + for (GeyserConnection connection : geyser.onlineConnections()) { + if (username.equals(connection.name())) { + return connection; } } return null; } @Override - public GeyserSession getBedrockPlayer(UUID uuid) { + public GeyserConnection getBedrockPlayer(UUID uuid) { return geyser.connectionByUuid(uuid); } } diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java index 26217b835..8ca846cd9 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/FastLoginVelocity.java @@ -53,7 +53,7 @@ import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import org.geysermc.floodgate.api.FloodgateApi; -import org.geysermc.geyser.GeyserImpl; +import org.geysermc.geyser.api.GeyserApi; import org.slf4j.Logger; import java.io.IOException; @@ -106,7 +106,7 @@ public void onProxyInitialization(ProxyInitializeEvent event) { } if (isPluginInstalled("Geyser-Velocity")) { - geyserService = new GeyserService(GeyserImpl.getInstance(), core); + geyserService = new GeyserService(GeyserApi.api(), core); } server.getEventManager().register(this, new ConnectListener(this, core.getAntiBotService()));