Patbox / TextPlaceholderAPI

Placeholder API for Fabric
GNU Lesser General Public License v3.0
40 stars 16 forks source link

The reversed operation of parseText() #59

Closed sakurawald closed 1 month ago

sakurawald commented 1 month ago

Now i can use parser.parseText() to convert quick-text string into Text. I am wondering if there is a way existing to convert Text into quick-text string.

sakurawald commented 1 month ago

This function is not used ofter. For persist the Text instance, there are gson serializer/deserializer provided by mojang.

Patbox commented 1 month ago

Myself I would recommend just storing the input instead, as generated one might not match user input at all (for example, gradients couldn't really be reversed, unless a lot of math/checking was used, but even then it can slightly change when I tweak the code).

You can use included WrappedText utility class for that

sakurawald commented 1 month ago

Myself I would recommend just storing the input instead, as generated one might not match user input at all (for example, gradients couldn't really be reversed, unless a lot of math/checking was used, but even then it can slightly change when I tweak the code).

You can use included WrappedText utility class for that

Okay, thank you <3.