Program: 80844
Project: 80844
Buggy source:
private PacketListenerResult onPlayerListPacketInternal(PlayerListItem packet){
switch (packet.getAction()) {
case ADD_PLAYER:
    for (    PlayerListItem.Item item : packet.getItems()) {
      if (fakePlayerUUIDSet.contains(item.getUuid())) {
        throw new AssertionError("String_Node_Str" + item);
      }
      if (fakePlayerUsernameSet.contains(item.getUsername())) {
        throw new AssertionError("String_Node_Str" + item);
      }
      serverTabList.put(item.getUuid(),new TabListItem(item));
    }
  break;
case UPDATE_GAMEMODE:
for (PlayerListItem.Item item : packet.getItems()) {
  TabListItem tabListItem=serverTabList.get(item.getUuid());
  if (tabListItem != null) {
    tabListItem.setGamemode(item.getGamemode());
  }
}
break;
case UPDATE_LATENCY:
for (PlayerListItem.Item item : packet.getItems()) {
TabListItem tabListItem=serverTabList.get(item.getUuid());
if (tabListItem != null) {
tabListItem.setPing(item.getPing());
}
}
break;
case UPDATE_DISPLAY_NAME:
for (PlayerListItem.Item item : packet.getItems()) {
TabListItem tabListItem=serverTabList.get(item.getUuid());
if (tabListItem != null) {
tabListItem.setDisplayName(item.getDisplayName());
}
}
break;
case REMOVE_PLAYER:
for (PlayerListItem.Item item : packet.getItems()) {
serverTabList.remove(item.getUuid());
}
break;
}
if (serverTabList.size() > size) {
if (resizePolicy.isMod20()) {
setSizeInternal(min(((serverTabList.size() + 19) / 20) * 20,80));
}
 else {
setSizeInternal(min(serverTabList.size(),80));
}
}
if (passtrough || size == 80) {
sendPacket(packet);
return PacketListenerResult.CANCEL;
}
switch (packet.getAction()) {
case ADD_PLAYER:
for (PlayerListItem.Item item : packet.getItems()) {
if (item.getGamemode() == 3 && item.getUuid().equals(getUniqueId())) {
int slot=uuidToSlotMap.getInt(item.getUuid());
if (slot != -1) {
if (slot != size - 1) {
useFakePlayerForSlot(slot);
slot=size - 1;
if (clientUuid[slot] != fakePlayerUUIDs[slot]) {
int targetSlot=findSlotForPlayer(clientUuid[slot]);
useRealPlayerForSlot(targetSlot,clientUuid[slot]);
}
useRealPlayerForSlot(slot,item.getUuid());
}
 else {
useRealPlayerForSlot(slot,item.getUuid());
}
}
 else {
slot=size - 1;
if (clientUuid[slot] != fakePlayerUUIDs[slot]) {
int targetSlot=findSlotForPlayer(clientUuid[slot]);
useRealPlayerForSlot(targetSlot,clientUuid[slot]);
}
useRealPlayerForSlot(slot,item.getUuid());
}
}
 else {
item.setGamemode(0);
int slot;
if (-1 != (slot=uuidToSlotMap.getInt(item.getUuid())) && !skinUuidToSlotMap.contains(item.getUuid(),-1)) {
useFakePlayerForSlot(slot);
}
if (slot != -1) {
useRealPlayerForSlot(slot,item.getUuid());
}
 else {
slot=findSlotForPlayer(item.getUuid());
useRealPlayerForSlot(slot,item.getUuid());
}
}
}
break;
case UPDATE_GAMEMODE:
for (PlayerListItem.Item item : packet.getItems()) {
if (!serverTabList.containsKey(item.getUuid())) {
continue;
}
if (item.getUuid().equals(getUniqueId())) {
int slot=uuidToSlotMap.getInt(item.getUuid());
if (item.getGamemode() == 3 && slot != size - 1) {
useFakePlayerForSlot(slot);
slot=size - 1;
if (clientUuid[slot] != fakePlayerUUIDs[slot]) {
int targetSlot=findSlotForPlayer(clientUuid[slot]);
useRealPlayerForSlot(targetSlot,clientUuid[slot]);
}
useRealPlayerForSlot(slot,item.getUuid());
}
 else if (item.getGamemode() != 3 && slot == size - 1) {
useFakePlayerForSlot(size - 1);
useRealPlayerForSlot(findSlotForPlayer(getUniqueId()),getUniqueId());
}
}
}
break;
case REMOVE_PLAYER:
sendPacket(packet);
for (PlayerListItem.Item item : packet.getItems()) {
int slot=uuidToSlotMap.getInt(item.getUuid());
if (-1 != slot) {
useFakePlayerForSlot(slot);
}
}
break;
case UPDATE_LATENCY:
case UPDATE_DISPLAY_NAME:
break;
}
if (size != requestedSize && serverTabList.size() < requestedSize) {
setSizeInternal(requestedSize);
}
return PacketListenerResult.CANCEL;
}

Fixed version (ground truth):
private PacketListenerResult onPlayerListPacketInternal(PlayerListItem packet){
switch (packet.getAction()) {
case ADD_PLAYER:
    for (    PlayerListItem.Item item : packet.getItems()) {
      if (fakePlayerUUIDSet.contains(item.getUuid())) {
        throw new AssertionError("String_Node_Str" + item);
      }
      if (fakePlayerUsernameSet.contains(item.getUsername())) {
        throw new AssertionError("String_Node_Str" + item);
      }
      serverTabList.put(item.getUuid(),new TabListItem(item));
    }
  break;
case UPDATE_GAMEMODE:
for (PlayerListItem.Item item : packet.getItems()) {
  TabListItem tabListItem=serverTabList.get(item.getUuid());
  if (tabListItem != null) {
    tabListItem.setGamemode(item.getGamemode());
  }
}
break;
case UPDATE_LATENCY:
for (PlayerListItem.Item item : packet.getItems()) {
TabListItem tabListItem=serverTabList.get(item.getUuid());
if (tabListItem != null) {
tabListItem.setPing(item.getPing());
}
}
break;
case UPDATE_DISPLAY_NAME:
for (PlayerListItem.Item item : packet.getItems()) {
TabListItem tabListItem=serverTabList.get(item.getUuid());
if (tabListItem != null) {
tabListItem.setDisplayName(item.getDisplayName());
}
}
break;
case REMOVE_PLAYER:
for (PlayerListItem.Item item : packet.getItems()) {
serverTabList.remove(item.getUuid());
}
break;
}
if (serverTabList.size() > size) {
if (resizePolicy.isMod20()) {
setSizeInternal(min(((serverTabList.size() + 19) / 20) * 20,80));
}
 else {
setSizeInternal(min(serverTabList.size(),80));
}
}
if (passtrough || size == 80) {
sendPacket(packet);
return PacketListenerResult.CANCEL;
}
switch (packet.getAction()) {
case ADD_PLAYER:
for (PlayerListItem.Item item : packet.getItems()) {
if (item.getGamemode() == 3 && item.getUuid().equals(getUniqueId())) {
int slot=uuidToSlotMap.getInt(item.getUuid());
if (slot != -1) {
if (slot != size - 1) {
useFakePlayerForSlot(slot);
slot=size - 1;
if (clientUuid[slot] != fakePlayerUUIDs[slot]) {
int targetSlot=findSlotForPlayer(clientUuid[slot]);
useRealPlayerForSlot(targetSlot,clientUuid[slot]);
}
useRealPlayerForSlot(slot,item.getUuid());
}
 else {
useRealPlayerForSlot(slot,item.getUuid());
}
}
 else {
slot=size - 1;
if (clientUuid[slot] != fakePlayerUUIDs[slot]) {
int targetSlot=findSlotForPlayer(clientUuid[slot]);
useRealPlayerForSlot(targetSlot,clientUuid[slot]);
}
useRealPlayerForSlot(slot,item.getUuid());
}
}
 else {
item.setGamemode(0);
int slot;
if (-1 != (slot=uuidToSlotMap.getInt(item.getUuid())) && !skinUuidToSlotMap.contains(item.getUuid(),-1)) {
useFakePlayerForSlot(slot);
}
if (slot != -1) {
useRealPlayerForSlot(slot,item.getUuid());
}
 else {
slot=findSlotForPlayer(item.getUuid());
useRealPlayerForSlot(slot,item.getUuid());
}
}
}
break;
case UPDATE_GAMEMODE:
for (PlayerListItem.Item item : packet.getItems()) {
if (!serverTabList.containsKey(item.getUuid())) {
continue;
}
if (item.getUuid().equals(getUniqueId())) {
int slot=uuidToSlotMap.getInt(item.getUuid());
if (item.getGamemode() == 3 && slot != size - 1) {
useFakePlayerForSlot(slot);
slot=size - 1;
if (clientUuid[slot] != fakePlayerUUIDs[slot]) {
int targetSlot=findSlotForPlayer(clientUuid[slot]);
useRealPlayerForSlot(targetSlot,clientUuid[slot]);
}
useRealPlayerForSlot(slot,item.getUuid());
}
 else if (item.getGamemode() != 3 && slot == size - 1) {
useFakePlayerForSlot(size - 1);
useRealPlayerForSlot(findSlotForPlayer(getUniqueId()),getUniqueId());
}
 else {
PlayerListItem packetOut=new PlayerListItem();
packetOut.setAction(UPDATE_GAMEMODE);
packetOut.setItems(new PlayerListItem.Item[]{item});
sendPacket(packetOut);
}
}
}
break;
case REMOVE_PLAYER:
sendPacket(packet);
for (PlayerListItem.Item item : packet.getItems()) {
int slot=uuidToSlotMap.getInt(item.getUuid());
if (-1 != slot) {
useFakePlayerForSlot(slot);
}
}
break;
case UPDATE_LATENCY:
case UPDATE_DISPLAY_NAME:
break;
}
if (size != requestedSize && serverTabList.size() < requestedSize) {
setSizeInternal(requestedSize);
}
return PacketListenerResult.CANCEL;
}