@Override public void onUpdate(PlayerListItem playerListItem) { for ( PlayerListItem.Item item : playerListItem.getItems() ) { if ( playerListItem.getAction() == PlayerListItem.Action.ADD_PLAYER ) { uuids.add( item.getUuid() ); } else if ( playerListItem.getAction() == PlayerListItem.Action.REMOVE_PLAYER ) { uuids.remove( item.getUuid() ); } } player.unsafe().sendPacket( playerListItem ); }
@Override public void onUpdate(PlayerListItem playerListItem) { for ( PlayerListItem.Item item : playerListItem.getItems() ) { if ( playerListItem.getAction() == PlayerListItem.Action.ADD_PLAYER ) { if ( item.getUuid() != null ) { uuids.add( item.getUuid() ); } else { usernames.add( item.getUsername() ); } } else if ( playerListItem.getAction() == PlayerListItem.Action.REMOVE_PLAYER ) { if ( item.getUuid() != null ) { uuids.remove( item.getUuid() ); } else { usernames.remove( item.getUsername() ); } } } player.unsafe().sendPacket( playerListItem ); }
item.setUsername(tabListItem.getUsername()); item.setProperties(tabListItem.getProperties()); realPlayers.remove(item.getUuid()); } else if (size - i - (isSpectator ? 1 : 0) > realPlayers.size()) { item.setUuid(fakePlayerUUIDs[i]); item.setDisplayName(clientText[i]); clientUuid[i] = item.getUuid(); clientUsername[i] = item.getUsername(); uuidToSlotMap.put(item.getUuid(), i); addPlayerToTeam(i, item.getUuid(), item.getUsername());
case ADD_PLAYER: for (PlayerListItem.Item item : packet.getItems()) { if (fakePlayerUUIDSet.contains(item.getUuid())) { throw new AssertionError("UUID collision: " + item); serverTabList.put(item.getUuid(), new TabListItem(item)); TabListItem tabListItem = serverTabList.get(item.getUuid()); if (tabListItem != null) { tabListItem.setGamemode(item.getGamemode()); case UPDATE_LATENCY: for (PlayerListItem.Item item : packet.getItems()) { TabListItem tabListItem = serverTabList.get(item.getUuid()); if (tabListItem != null) { tabListItem.setPing(item.getPing()); case UPDATE_DISPLAY_NAME: for (PlayerListItem.Item item : packet.getItems()) { TabListItem tabListItem = serverTabList.get(item.getUuid()); if (tabListItem != null) { tabListItem.setDisplayName(item.getDisplayName()); case REMOVE_PLAYER: for (PlayerListItem.Item item : packet.getItems()) { serverTabList.remove(item.getUuid()); case ADD_PLAYER: for (PlayerListItem.Item item : packet.getItems()) {
UUID uuid = item.getUuid(); UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID(uuid); if (player != null) { UUID uuid = rewriteMap.remove(item.getUuid()); modified |= uuid != null; item.setUuid(MoreObjects.firstNonNull(uuid, item.getUuid())); UUID uuid = rewriteMap.get(item.getUuid()); if (uuid != null) { modified = true; if (packet.getAction() == PlayerListItem.Action.ADD_PLAYER) { UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID(item.getUuid()); if (player != null) { LoginResult loginResult = player.getPendingConnection().getLoginProfile();
public TabListItemWrapper wrapTabListItem(PlayerListItem.Item item) { return new TabListItemWrapper(item.getUuid().toString(), item.getUsername(), item.getDisplayName(), item.getPing(), item.getGamemode(), wrapProperties(item.getProperties())); }
@Override protected void sendPacket(DefinedPacket packet) { if (!onlineMode && packet instanceof PlayerListItem) { PlayerListItem pli = (PlayerListItem) packet; if (pli.getAction() == PlayerListItem.Action.ADD_PLAYER) { for (PlayerListItem.Item item : pli.getItems()) { if (fakePlayerUUIDSet.contains(item.getUuid())) { item.setProperties(EMPTY_PROPRTIES); } } } } player.unsafe().sendPacket(packet); }
@Override public PacketListenerResult onPlayerListPacket(PlayerListItem packet) { if (packet.getAction() == PlayerListItem.Action.ADD_PLAYER || packet.getAction() == PlayerListItem.Action.UPDATE_GAMEMODE) { for (PlayerListItem.Item item : packet.getItems()) { if (userConnection.getUniqueId().equals(item.getUuid())) { userConnection.setGamemode(item.getGamemode()); } } } return super.onPlayerListPacket(packet); } }
private TabListItem(PlayerListItem.Item item) { this(item.getUuid(), item.getProperties(), item.getUsername(), item.getDisplayName(), item.getPing(), item.getGamemode()); } }