From 5a02b476042b296a78be2650cd542bc34e67423c Mon Sep 17 00:00:00 2001 From: Florian Stober Date: Sat, 21 Oct 2023 12:21:21 +0200 Subject: [PATCH] after server switch delay updating tab list until receiving tab list packets from the server; see #731 --- .../handler/NewTabOverlayHandler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bungee/src/main/java/codecrafter47/bungeetablistplus/handler/NewTabOverlayHandler.java b/bungee/src/main/java/codecrafter47/bungeetablistplus/handler/NewTabOverlayHandler.java index 50fea221..ffeef845 100644 --- a/bungee/src/main/java/codecrafter47/bungeetablistplus/handler/NewTabOverlayHandler.java +++ b/bungee/src/main/java/codecrafter47/bungeetablistplus/handler/NewTabOverlayHandler.java @@ -205,6 +205,12 @@ public PacketListenerResult onPlayerListPacket(PlayerListItem packet) { @Override public PacketListenerResult onPlayerListUpdatePacket(PlayerListItemUpdate packet) { + + if (!active) { + active = true; + scheduleUpdate(); + } + if (packet.getActions().contains(PlayerListItemUpdate.Action.ADD_PLAYER)) { for (PlayerListItem.Item item : packet.getItems()) { if (OPTION_ENABLE_CUSTOM_SLOT_UUID_COLLISION_CHECK) { @@ -298,6 +304,8 @@ public void onServerSwitch(boolean is13OrLater) { if (serverFooter != null) { serverFooter = EMPTY_JSON_TEXT; } + + active = false; } @Override @@ -345,7 +353,7 @@ private void update() { updateScheduledFlag.set(false); ChannelWrapper ch = ((UserConnection) player).getCh(); - if (ch.isClosed() || ch.getEncodeProtocol() != Protocol.GAME) { + if (!active || ch.isClosed() || ch.getEncodeProtocol() != Protocol.GAME) { return; }