Skip to content

Commit

Permalink
after server switch delay updating tab list until receiving tab list …
Browse files Browse the repository at this point in the history
…packets from the server; see #731
  • Loading branch information
CodeCrafter47 committed Oct 21, 2023
1 parent e35f7e1 commit 5a02b47
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -298,6 +304,8 @@ public void onServerSwitch(boolean is13OrLater) {
if (serverFooter != null) {
serverFooter = EMPTY_JSON_TEXT;
}

active = false;
}

@Override
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 5a02b47

Please sign in to comment.