Skip to content

Commit

Permalink
Add a temporary workaround for SpigotMC/BungeeCord#3542
Browse files Browse the repository at this point in the history
  • Loading branch information
NEZNAMY committed Oct 1, 2023
1 parent 4cd50fb commit 54e8e1e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 54e8e1e

Please sign in to comment.