From 10737f17e2b0bf39817aba6d208096716d3e5357 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 10 Mar 2023 14:29:28 +0100 Subject: [PATCH] Delay version detection when using legacy injector --- .../java/com/viaversion/viaversion/ViaVersionPlugin.java | 3 +++ .../viaversion/bukkit/platform/BukkitViaInjector.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java b/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java index f6145aac7..126292f58 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/ViaVersionPlugin.java @@ -114,6 +114,9 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform getServer().getPluginManager().registerEvent(serverInitEventClass, new Listener() { }, EventPriority.HIGHEST, (listener, event) -> manager.onServerLoaded(), this); + } else if (Via.getManager().getInjector().lateProtocolVersionSetting()) { + // Enable after server has loaded at the next tick + runSync(manager::onServerLoaded); } else { manager.onServerLoaded(); } diff --git a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java index 5bf0dce2c..0085aadea 100644 --- a/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java +++ b/bukkit/src/main/java/com/viaversion/viaversion/bukkit/platform/BukkitViaInjector.java @@ -153,6 +153,11 @@ public class BukkitViaInjector extends LegacyViaInjector { } } + @Override + public boolean lateProtocolVersionSetting() { + return !PaperViaInjector.PAPER_PROTOCOL_METHOD; + } + public boolean isBinded() { if (PaperViaInjector.PAPER_INJECTION_METHOD) { return true;