From 54e8e1ea98665cb3d2e636b3b3a29201375b6bbe Mon Sep 17 00:00:00 2001 From: NEZNAMY Date: Sun, 1 Oct 2023 16:35:33 +0200 Subject: [PATCH] Add a temporary workaround for https://github.com/SpigotMC/BungeeCord/issues/3542 --- .../tab/platforms/bungeecord/BungeeEventListener.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bungeecord/src/main/java/me/neznamy/tab/platforms/bungeecord/BungeeEventListener.java b/bungeecord/src/main/java/me/neznamy/tab/platforms/bungeecord/BungeeEventListener.java index 669a205a6..64d9a970d 100644 --- a/bungeecord/src/main/java/me/neznamy/tab/platforms/bungeecord/BungeeEventListener.java +++ b/bungeecord/src/main/java/me/neznamy/tab/platforms/bungeecord/BungeeEventListener.java @@ -1,5 +1,6 @@ package me.neznamy.tab.platforms.bungeecord; +import me.neznamy.tab.shared.ProtocolVersion; import me.neznamy.tab.shared.TAB; import me.neznamy.tab.shared.TabConstants; import me.neznamy.tab.shared.platform.EventListener; @@ -25,7 +26,13 @@ public void onQuit(PlayerDisconnectEvent e) { @EventHandler public void onSwitch(ServerSwitchEvent e) { - serverChange(e.getPlayer(), e.getPlayer().getUniqueId(), e.getPlayer().getServer().getInfo().getName()); + Runnable task = () -> serverChange(e.getPlayer(), e.getPlayer().getUniqueId(), e.getPlayer().getServer().getInfo().getName()); + // Temporary workaround until https://github.com/SpigotMC/BungeeCord/issues/3542 is resolved + if (e.getPlayer().getPendingConnection().getVersion() >= ProtocolVersion.V1_20_2.getNetworkId()) { + TAB.getInstance().getCPUManager().runTaskLater(500, "", "", task); + } else { + task.run(); + } } @EventHandler