From f86c918a8b5bfd267dd458256a13c2b0d81f7115 Mon Sep 17 00:00:00 2001 From: TuxCoding <1957196+TuxCoding@users.noreply.github.com> Date: Mon, 23 Jun 2025 10:44:58 +0200 Subject: [PATCH] Use Paper API for detecting proxies (1.21.6+) Related #1312 --- bukkit/pom.xml | 2 +- .../github/games647/fastlogin/bukkit/BungeeManager.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bukkit/pom.xml b/bukkit/pom.xml index 3d3a0efc..fbd46930 100644 --- a/bukkit/pom.xml +++ b/bukkit/pom.xml @@ -168,7 +168,7 @@ io.papermc.paper paper-api - 1.20.6-R0.1-SNAPSHOT + 1.21.6-R0.1-SNAPSHOT provided diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java index c1a46275..2e0db561 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java @@ -31,6 +31,7 @@ import com.github.games647.fastlogin.core.message.LoginActionMessage; import com.github.games647.fastlogin.core.message.NamespaceKey; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; +import io.papermc.paper.configuration.ServerConfiguration; import org.bukkit.Bukkit; import org.bukkit.Server; import org.bukkit.entity.Player; @@ -133,6 +134,13 @@ public class BungeeManager { } private boolean detectProxy() { + try { + ServerConfiguration.class.getDeclaredMethod("isProxyEnabled"); + return Bukkit.getServerConfig().isProxyEnabled(); + } catch (NoSuchMethodException noSuchMethodEx) { + // Ignore continue below + } + try { if (isProxySupported("org.spigotmc.SpigotConfig", "bungee")) { return true;