From 4bf692b41a2a546c89e0dc2380043217425d91bf Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Wed, 7 Aug 2024 00:56:23 +0200 Subject: [PATCH] Feature: Detect incorrect proxy setups --- .../platform/spigot/GeyserSpigotPlugin.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java index 3bb44a4bc..4b2c98883 100644 --- a/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java +++ b/bootstrap/spigot/src/main/java/org/geysermc/geyser/platform/spigot/GeyserSpigotPlugin.java @@ -148,6 +148,22 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { return; } + try { + // Check spigot config for BungeeCord mode + if (!Boolean.TRUE.equals(Bukkit.getServer().spigot().getConfig().get("settings.bungeecord"))) { + disableOnBackendServers("BungeeCord"); + return; + } + + // Now: Check for velocity mode - deliberately after checking bungeecord because this is a paper config + if (!Boolean.TRUE.equals(Bukkit.getServer().spigot().getPaperConfig().get("proxies.velocity.enabled"))) { + disableOnBackendServers("Velocity"); + return; + } + } catch (NoSuchMethodError e) { + // no-op + } + if (!loadConfig()) { return; } @@ -458,4 +474,14 @@ public class GeyserSpigotPlugin extends JavaPlugin implements GeyserBootstrap { return true; } + + private void disableOnBackendServers(String platform) { + geyserLogger.error("*********************************************"); + geyserLogger.error(""); + geyserLogger.error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.unsupported_proxy_backend", platform)); + geyserLogger.error(GeyserLocale.getLocaleStringLog("geyser.bootstrap.setup_guide", "https://geysermc.org/wiki/geyser/setup/")); + geyserLogger.error(""); + geyserLogger.error("*********************************************"); + Bukkit.getPluginManager().disablePlugin(this); + } }