Scoreboard Team set display name not work
imDMK opened this issue ยท 0 comments
Make sure you're doing the following
- You're using the latest build for your server version
- This isn't an issue caused by another plugin
- You've checked for duplicate issues
- You didn't use
/reload
Describe the question
Set display name not work.
API method(s) used
ProtocolLib
Expected behavior
Display name change (above player)
Code
public Nametag(Player player) {
this.player = player;
this.packetContainer = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_TEAM);
//Write defaults
this.packetContainer.getModifier().writeDefaults();
//Write mode
this.packetContainer.getIntegers().write(0, 0);
//Set team name
this.packetContainer.getStrings().write(0, player.getName());
this.packetContainer.getOptionalStructures().read(0).map(internalStructure -> {
//Set visibility
internalStructure.getStrings().write(0, "always");
//Set display name
internalStructure.getChatComponents().write(0, WrappedChatComponent.fromText("test123")) //Doesn't work
return internalStructure;
});
//Add the player to the team
this.packetContainer.getSpecificModifier(Collection.class).write(0, Collections.singletonList(player.getName()));
}
Additional context
Server version: 1.19.2
ProtocolLib version: 5.0.0-SNAPSHOT-b612