Skip to content

Commit

Permalink
Fix an issue related to 1.8.8 connections.
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinceBunBun981 authored and CodeCrafter47 committed Nov 13, 2023
1 parent 9c56d1b commit 6b52263
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ PacketListenerResult onPlayerListPacket(PlayerListItem packet) {
// 2. add player to correct team
sendPacket(createPacketTeamAddPlayers(playerTeamName, new String[]{slotUsername[index]}));
// 3. reset custom slot team
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1));
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1));
}
}

Expand Down Expand Up @@ -1059,7 +1059,7 @@ void onTeamPacketPreprocess(Team packet) {
int slot = playerUsernameToSlotMap.getInt(playerName);
if (slot != -1) {
// reset slot team
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[slot], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1));
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[slot], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1));
}
}
}
Expand Down Expand Up @@ -1137,7 +1137,7 @@ PacketListenerResult onTeamPacket(Team packet) {
filteredPlayers[j++] = playerName;
} else {
// reset slot team
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[slot], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1));
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[slot], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1));
}
}
packet.setPlayers(filteredPlayers);
Expand Down Expand Up @@ -1211,7 +1211,7 @@ void onServerSwitch() {
// 1. remove player from team
sendPacket(createPacketTeamRemovePlayers(CUSTOM_SLOT_TEAMNAME[index], new String[]{slotUsername[index]}));
// reset slot team
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1));
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1));
}

// 2. create new custom slot
Expand Down Expand Up @@ -1314,12 +1314,12 @@ private void createTeamsIfNecessary() {
if (!hasCreatedCustomTeams) {
hasCreatedCustomTeams = true;

sendPacket(createPacketTeamCreate(CUSTOM_SLOT_TEAMNAME[0], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1, new String[]{CUSTOM_SLOT_USERNAME[0], CUSTOM_SLOT_USERNAME_SMILEYS[0], ""}));
sendPacket(createPacketTeamCreate(CUSTOM_SLOT_TEAMNAME[0], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1, new String[]{CUSTOM_SLOT_USERNAME[0], CUSTOM_SLOT_USERNAME_SMILEYS[0], ""}));

for (int i = 1; i < 80; i++) {
sendPacket(createPacketTeamCreate(CUSTOM_SLOT_TEAMNAME[i], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1, new String[]{CUSTOM_SLOT_USERNAME[i], CUSTOM_SLOT_USERNAME_SMILEYS[i]}));
sendPacket(createPacketTeamCreate(CUSTOM_SLOT_TEAMNAME[i], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1, new String[]{CUSTOM_SLOT_USERNAME[i], CUSTOM_SLOT_USERNAME_SMILEYS[i]}));
}
sendPacket(createPacketTeamCreate(CUSTOM_SLOT_TEAMNAME[80], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1, new String[]{CUSTOM_SLOT_USERNAME[80]}));
sendPacket(createPacketTeamCreate(CUSTOM_SLOT_TEAMNAME[80], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1, new String[]{CUSTOM_SLOT_USERNAME[80]}));
}
}

Expand All @@ -1338,7 +1338,7 @@ void onDeactivated() {
// 2. add player to correct team
sendPacket(createPacketTeamAddPlayers(playerTeamName, new String[]{slotUsername[index]}));
// 3. reset custom slot team
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1));
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1));
}
} else {
customSlots++;
Expand Down Expand Up @@ -1470,7 +1470,7 @@ void update() {
// 2. add player to correct team
sendPacket(createPacketTeamAddPlayers(playerTeamName, new String[]{slotUsername[index]}));
// 3. reset custom slot team
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1));
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1));
} else {
// 2. add player to overflow team
sendPacket(createPacketTeamAddPlayers(CUSTOM_SLOT_TEAMNAME[80], new String[]{slotUsername[index]}));
Expand Down Expand Up @@ -1658,7 +1658,7 @@ void update() {
playerUsernameToSlotMap.removeInt(slotUsername[index]);

// reset slot team
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1));
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1));
}

// 2. update slot state
Expand All @@ -1679,7 +1679,7 @@ void update() {
playerUsernameToSlotMap.removeInt(slotUsername[index]);

// reset slot team
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", 21, (byte) 1));
sendPacket(createPacketTeamUpdate(CUSTOM_SLOT_TEAMNAME[index], emptyEither, emptyEither, emptyEither, "always", "always", is13OrLater ? 21 : 0, (byte) 1));
}

freePlayers.add(slotUuid[index]);
Expand Down

0 comments on commit 6b52263

Please sign in to comment.