Examples of PlayerListItem


Examples of net.md_5.bungee.protocol.packet.PlayerListItem

            // since the packet from the server arrives
            // too late
            // TODO: This should only done with server_unique
            //       tab list (which is the only one supported
            //       currently)
            PlayerListItem packet = new PlayerListItem();
            packet.setAction( PlayerListItem.Action.REMOVE_PLAYER );
            PlayerListItem.Item item = new PlayerListItem.Item();
            item.setUuid( con.getUniqueId() );
            packet.setItems( new PlayerListItem.Item[]{
                    item
            } );
            for ( ProxiedPlayer player : con.getServer().getInfo().getPlayers() )
            {
                player.unsafe().sendPacket( packet );
View Full Code Here

Examples of net.md_5.bungee.protocol.packet.PlayerListItem

    public void onPingChange(int ping)
    {
        if ( !sentPing )
        {
            sentPing = true;
            PlayerListItem packet = new PlayerListItem();
            packet.setAction( PlayerListItem.Action.UPDATE_LATENCY );
            PlayerListItem.Item item = new PlayerListItem.Item();
            item.setUuid( player.getUniqueId() );
            item.setUsername( player.getName() );
            item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( player.getDisplayName() ) ) );
            item.setPing( player.getPing() );
            packet.setItems( new PlayerListItem.Item[]
            {
                item
            } );
            BungeeCord.getInstance().broadcast( packet );
        }
View Full Code Here

Examples of net.md_5.bungee.protocol.packet.PlayerListItem

    }

    @Override
    public void onConnect()
    {
        PlayerListItem playerListItem = new PlayerListItem();
        playerListItem.setAction( PlayerListItem.Action.ADD_PLAYER );
        Collection<ProxiedPlayer> players = BungeeCord.getInstance().getPlayers();
        PlayerListItem.Item[] items = new PlayerListItem.Item[ players.size() ];
        playerListItem.setItems( items );
        int i = 0;
        for ( ProxiedPlayer p : players )
        {
            PlayerListItem.Item item = items[i++] = new PlayerListItem.Item();
            item.setUuid( p.getUniqueId() );
            item.setUsername( p.getName() );
            item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( p.getDisplayName() ) ) );
            LoginResult loginResult = ( (UserConnection) p ).getPendingConnection().getLoginProfile();
            if ( loginResult != null )
            {
                String[][] props = new String[ loginResult.getProperties().length ][];
                for ( int j = 0; j < props.length; j++ )
                {
                    props[ j ] = new String[]
                    {
                            loginResult.getProperties()[ j ].getName(),
                            loginResult.getProperties()[ j ].getValue(),
                            loginResult.getProperties()[ j ].getSignature()
                    };
                }
                item.setProperties( props );
            } else
            {
                item.setProperties( new String[0][0] );
            }
            item.setGamemode( ( (UserConnection) p ).getGamemode() );
            item.setPing( p.getPing() );
        }
        if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
        {
            player.unsafe().sendPacket( playerListItem );
        } else
        {
            // Split up the packet
            for ( PlayerListItem.Item item : playerListItem.getItems() )
            {
                PlayerListItem packet = new PlayerListItem();
                packet.setAction( playerListItem.getAction() );

                packet.setItems( new PlayerListItem.Item[]
                {
                    item
                } );
                player.unsafe().sendPacket( packet );
            }
        }
        PlayerListItem packet = new PlayerListItem();
        packet.setAction( PlayerListItem.Action.ADD_PLAYER );
        PlayerListItem.Item item = new PlayerListItem.Item();
        item.setUuid( player.getUniqueId() );
        item.setUsername( player.getName() );
        item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( player.getDisplayName() ) ) );
        LoginResult loginResult = ( (UserConnection) player ).getPendingConnection().getLoginProfile();
        if ( loginResult != null ) {
            String[][] props = new String[ loginResult.getProperties().length ][];
            for ( int j = 0; j < props.length; j++ )
            {
                props[ j ] = new String[]
                {
                        loginResult.getProperties()[ j ].getName(),
                        loginResult.getProperties()[ j ].getValue(),
                        loginResult.getProperties()[ j ].getSignature()
                };
            }
            item.setProperties( props );
        } else
        {
            item.setProperties( new String[ 0 ][ 0 ] );
        }
        item.setGamemode( ( (UserConnection) player ).getGamemode() );
        item.setPing( player.getPing() );
        packet.setItems( new PlayerListItem.Item[]
        {
            item
        } );
        BungeeCord.getInstance().broadcast( packet );
    }
View Full Code Here

Examples of net.md_5.bungee.protocol.packet.PlayerListItem

    }

    @Override
    public void onDisconnect()
    {
        PlayerListItem packet = new PlayerListItem();
        packet.setAction( PlayerListItem.Action.REMOVE_PLAYER );
        PlayerListItem.Item item = new PlayerListItem.Item();
        item.setUuid( player.getUniqueId() );
        item.setUsername( player.getName() );
        packet.setItems( new PlayerListItem.Item[]
        {
            item
        } );
        BungeeCord.getInstance().broadcast( packet );
    }
View Full Code Here

Examples of net.md_5.bungee.protocol.packet.PlayerListItem

    }

    @Override
    public void onServerChange()
    {
        PlayerListItem packet = new PlayerListItem();
        packet.setAction( PlayerListItem.Action.REMOVE_PLAYER );
        PlayerListItem.Item[] items = new PlayerListItem.Item[ uuids.size() + usernames.size() ];
        int i = 0;
        for ( UUID uuid : uuids )
        {
            PlayerListItem.Item item = items[i++] = new PlayerListItem.Item();
            item.setUuid( uuid );
        }
        for ( String username : usernames )
        {
            PlayerListItem.Item item = items[i++] = new PlayerListItem.Item();
            item.setUsername( username );
            item.setDisplayName( username );
        }
        packet.setItems( items );
        if ( player.getPendingConnection().getVersion() >= ProtocolConstants.MINECRAFT_SNAPSHOT )
        {
            player.unsafe().sendPacket( packet );
        } else
        {
            // Split up the packet
            for ( PlayerListItem.Item item : packet.getItems() )
            {
                PlayerListItem p2 = new PlayerListItem();
                p2.setAction( packet.getAction() );

                p2.setItems( new PlayerListItem.Item[]
                {
                    item
                } );
                player.unsafe().sendPacket( p2 );
            }
View Full Code Here

Examples of net.md_5.bungee.protocol.packet.PlayerListItem

    public void onPingChange(int ping)
    {
        if ( ping - PING_THRESHOLD > lastPing && ping + PING_THRESHOLD < lastPing )
        {
            lastPing = ping;
            PlayerListItem packet = new PlayerListItem();
            packet.setAction( PlayerListItem.Action.UPDATE_LATENCY );
            PlayerListItem.Item item = new PlayerListItem.Item();
            item.setUuid( player.getUniqueId() );
            item.setUsername( player.getName() );
            item.setDisplayName( ComponentSerializer.toString( TextComponent.fromLegacyText( player.getDisplayName() ) ) );
            item.setPing( player.getPing() );
            packet.setItems( new PlayerListItem.Item[]
            {
                item
            } );
            BungeeCord.getInstance().broadcast( packet );
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.