@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 ); }
public PlayerListPacketWrapper wrapPlayerListPacket(PlayerListItem packet) { return new PlayerListPacketWrapper(packet.getAction(), Arrays.stream(packet.getItems()).map(this::wrapTabListItem).collect(Collectors.toCollection(ArrayList::new))); }
@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); } }
@Override public PacketListenerResult onPlayerListPacket(PlayerListItem packet) { if (packet.getAction() == PlayerListItem.Action.ADD_PLAYER) { for (PlayerListItem.Item item : packet.getItems()) { serverTabListEntryNames.add(getName(item)); serverTabList.put(getName(item), item.getPing()); } } else { for (PlayerListItem.Item item : packet.getItems()) { serverTabListEntryNames.remove(getName(item)); serverTabList.remove(getName(item)); } } return passThrough ? PacketListenerResult.PASS : PacketListenerResult.CANCEL; }
@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 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 ); }
@Override public PacketListenerResult onPlayerListPacket(PlayerListItem packet) { if (packet.getAction() == PlayerListItem.Action.ADD_PLAYER) { for (PlayerListItem.Item item : packet.getItems()) { UUID uuid = item.getUuid(); if (packet.getAction() == PlayerListItem.Action.REMOVE_PLAYER) { for (PlayerListItem.Item item : packet.getItems()) { UUID uuid = rewriteMap.remove(item.getUuid()); if (uuid != null) { modified = true; if (packet.getAction() == PlayerListItem.Action.ADD_PLAYER) { UserConnection player = BungeeCord.getInstance().getPlayerByOfflineUUID(item.getUuid()); if (player != null) {
p2.setAction( packet.getAction() );
packet.setAction( playerListItem.getAction() );