Skip to content

Commit f86c918

Browse files
committed
Use Paper API for detecting proxies (1.21.6+)
Related #1312
1 parent 001cf32 commit f86c918

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

bukkit/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
<dependency>
169169
<groupId>io.papermc.paper</groupId>
170170
<artifactId>paper-api</artifactId>
171-
<version>1.20.6-R0.1-SNAPSHOT</version>
171+
<version>1.21.6-R0.1-SNAPSHOT</version>
172172
<scope>provided</scope>
173173
<!-- Use our own newer api version -->
174174
<exclusions>

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.github.games647.fastlogin.core.message.NamespaceKey;
3232
import com.google.common.io.ByteArrayDataOutput;
3333
import com.google.common.io.ByteStreams;
34+
import io.papermc.paper.configuration.ServerConfiguration;
3435
import org.bukkit.Bukkit;
3536
import org.bukkit.Server;
3637
import org.bukkit.entity.Player;
@@ -133,6 +134,13 @@ private boolean isVelocityEnabled()
133134
}
134135

135136
private boolean detectProxy() {
137+
try {
138+
ServerConfiguration.class.getDeclaredMethod("isProxyEnabled");
139+
return Bukkit.getServerConfig().isProxyEnabled();
140+
} catch (NoSuchMethodException noSuchMethodEx) {
141+
// Ignore continue below
142+
}
143+
136144
try {
137145
if (isProxySupported("org.spigotmc.SpigotConfig", "bungee")) {
138146
return true;

0 commit comments

Comments
 (0)