[SPIGOT-7327] Add SignMeta Created: 06/Apr/23  Updated: 25/Dec/24

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

Type: New Feature Priority: Minor
Reporter: Photon Assignee: Parker Hawke
Resolution: Unresolved Votes: 0
Labels: None

Version: This server is running CraftBukkit version 3713-Spigot-b31949f-e430006 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT)
Guidelines Read: Yes

 Description   

Currently it is extremely hard to get or set the text and clickevents on a sign from the itemstack. For Books, there is a BookMeta (spigot) interface that allows you to get all pages, clickevents (and hoverevents), but no equivalent for signs exist. Even the BlockData Sign for placed signs is insufficient, as it only allows you to get and set the lines of the sign, but no further information, e.g. ClickEvents.

I could use the direct keys like text1, text2 and so on, but minecraft 1.20 will likely overhaul that system and it will be wasted work. Moreover, 1.20 will introduce front and back texts to signs, further complicating the endeavour without an API.

Therefore, I would like to see a similar SignMeta interface that allows you to do just that, similar to BookMeta.



 Comments   
Comment by Photon [ 08/Apr/23 ]

Yes, I have suspected something like this. Anyway, thanks for telling me about the BlockStateMeta. I will look forward to the improved Sign interface with BaseComponents.

Comment by md_5 [ 08/Apr/23 ]

If it were any other way then there would need to be an identical ItemMeta version of every time entity (read: thousands of lines of duplicated code)

Comment by Photon [ 08/Apr/23 ]

I honestly did not know about that.

However, to recap, to read from a sign you need to check a sign has itemmeta, get the itemmeta, know that it casts to BlockStateMeta, read the BlockState, know it can be casted to Sign and then I would be able to read the lines. I daresay, that API is maybe a bit convoluted.

Still, I would not be able to read the clickevents, so support for BaseComponents, like Black Hole mentioned, would be much appreciated.

Comment by md_5 [ 06/Apr/23 ]

You are aware of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/BlockStateMeta.html right? There isn't need for a specific sign meta.

Comment by Black Hole [ 06/Apr/23 ]

A SignMeta isn't needed. Items that are blocks entities when placed in the world support TileState. Books don't exist as blocks, only in inventories.

But the Sign could be improved to support BaseComponents. Such properties could be named frontLines to be prepared for 1.20 introducing backLines.

Generated at Tue Apr 15 09:10:55 UTC 2025 using Jira 10.3.3#10030003-sha1:d220e3fefc8dfc6d47f522d3b9a20c1455e12b7b.