[SPIGOT-4146] Inventory title not being parsed for colours Created: 24/Jul/18 Updated: 25/Jul/18 Resolved: 24/Jul/18 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Remco van Hooff | Assignee: | Unassigned |
Resolution: | Invalid | Votes: | 0 |
Labels: | Color, Craftbukkit, Inventory |
Version: | 1.13-pre6 |
Description |
Someone had started a thread about coloured text not showing up in inventories opened using plugins. Whilst looking through the source I saw the following line: player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title), size)); Whilst the open window packet does support coloured text (it is a Chat field and not a string field), the text gets directly inserted in a new ChatComponentText instead of first parsing the old chat format (paragraph sign + code) using the already available methods in Bukkit! This code is stated in: CraftHumanEntity#openCustomInventory(Inventory, EntityPlayer, String)
The fix is by changing that line to something like the following: player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0], size));
|
Comments |
Comment by md_5 [ 25/Jul/18 ] |
Comment by md_5 [ 24/Jul/18 ] |
This is what we send: [08:25:07 INFO]: {"extra":[ {"color":"red","text":"Test"}],"text":""} And the client doesn't render with colour. That's a client bug/feature. |
Comment by md_5 [ 24/Jul/18 ] |
Sid you test that fix? |