Fix tab list

This commit is contained in:
md_5 2014-08-31 19:01:24 +10:00
parent faa284c8fc
commit f15eed338d
4 changed files with 19 additions and 7 deletions

View File

@ -19,6 +19,12 @@
<description>Minimal implementation of the Minecraft protocol for use in BungeeCord</description> <description>Minimal implementation of the Minecraft protocol for use in BungeeCord</description>
<dependencies> <dependencies>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-chat</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId> <artifactId>netty-codec</artifactId>

View File

@ -9,6 +9,8 @@ import net.md_5.bungee.protocol.AbstractPacketHandler;
import net.md_5.bungee.protocol.ProtocolConstants; import net.md_5.bungee.protocol.ProtocolConstants;
import java.util.UUID; import java.util.UUID;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.chat.ComponentSerializer;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@ -89,7 +91,7 @@ public class PlayerListItem extends DefinedPacket
if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT ) if ( protocolVersion < ProtocolConstants.MINECRAFT_SNAPSHOT )
{ {
Item item = items[0]; // Only one at a time Item item = items[0]; // Only one at a time
writeString( item.displayName, buf ); writeString( TextComponent.toLegacyText( ComponentSerializer.parse( item.displayName ) ), buf );
buf.writeBoolean( action != Action.REMOVE_PLAYER ); buf.writeBoolean( action != Action.REMOVE_PLAYER );
buf.writeShort( item.ping ); buf.writeShort( item.ping );
} else } else

View File

@ -100,9 +100,11 @@ public class Global extends TabList
{ {
PlayerListItem packet = new PlayerListItem(); PlayerListItem packet = new PlayerListItem();
packet.setAction( playerListItem.getAction() ); packet.setAction( playerListItem.getAction() );
PlayerListItem.Item[] it = new PlayerListItem.Item[ 1 ];
it[0] = item; packet.setItems( new PlayerListItem.Item[]
packet.setItems( it ); {
item
} );
player.unsafe().sendPacket( packet ); player.unsafe().sendPacket( packet );
} }
} }

View File

@ -82,9 +82,11 @@ public class ServerUnique extends TabList
{ {
PlayerListItem p2 = new PlayerListItem(); PlayerListItem p2 = new PlayerListItem();
p2.setAction( packet.getAction() ); p2.setAction( packet.getAction() );
PlayerListItem.Item[] it = new PlayerListItem.Item[ 1 ];
it[0] = item; p2.setItems( new PlayerListItem.Item[]
p2.setItems( it ); {
item
} );
player.unsafe().sendPacket( p2 ); player.unsafe().sendPacket( p2 );
} }
} }