[SPIGOT-6541] When getting the block data from a sign(or wall_sign) there is no way to get the lines of the sign. Created: 13/Jun/21  Updated: 13/Jun/21  Resolved: 13/Jun/21

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: MoritzR200 Assignee: Unassigned
Resolution: Invalid Votes: 0
Labels: Essentials, Sign, bug

Version: Definitly 1.13-1.16 (but might be all versions)
Guidelines Read: Yes

 Description   

When retrieving a BlockData object (of type org.bukkit.block.data.type.Sign) from an Sign block(org.bukkit.block.Sign), the returned BlockData has no method to get or set the lines of the sign-data, even though this would be expected.
Even wore(I assume this is a result of the previous issue) when the getAsString() method is used on the BlockData the line-information is not contained within the output and therefore completely inaccessible.

//This basically serves as a minimal reproduction plugin.
Block b = null; // Initialized with a valid sign-block
BlockData blockData  = b.getBlockData();
String blockDataString = blockData.getAsString();
Bukkit.getLogger().info(blockDataString);

This code logs:
minecraft:oak_sign[rotation=0,waterlogged=false]

while F3+I returns:
/setblock -9 38 10 minecraft:oak_sign[rotation=0,waterlogged=false]{Color:"black",Text4:'{"extra":[

{"text":"t4"}

],"text":""}',Text3:'{"extra":[

{"text":"t3"}

],"text":""}',Text2:'{"extra":[

{"text":"t2"}

],"text":""}',Text1:'{"extra":[

{"text":"t1"}

],"text":""}'}

Resolving this issue would also be a good opportunity to add an API to set click-actions for signs to, but that is by no means needed to resolve the bug addressed in this issue.



 Comments   
Comment by MoritzR200 [ 13/Jun/21 ]

Thanks for your time

Comment by md_5 [ 13/Jun/21 ]

You use BlockState and associated APIs for accessing tile info.
BlockData is for materials.

Generated at Tue Apr 22 05:33:02 UTC 2025 using Jira 10.3.5#10030005-sha1:190c783f2bd6c69cd5accdb70f97e48812a78d14.