CryptoMorin / XSeries

Library for cross-version Minecraft Bukkit support and various efficient API methods.
https://www.spigotmc.org/threads/378136/
MIT License
403 stars 126 forks source link

[XItemStack] Support hex colors #283

Closed datatags closed 4 months ago

datatags commented 4 months ago

In the XItemStack docs, Color is defined as:

alias Color: for Text "red, green, blue" or "hex color"

However, XItemStack actually doesn't currently parse hex colors, only the comma-separated format is supported. This PR changes that, and now all of the following formats are supported:

Notes

The hex representation is automatically converted to decimal by SnakeYAML (and then converted to a string), so that format and the decimal representation end up being handled the same in the code. The bare format RRGGBB is also supported if it can't be parsed as a base-10 number, but due to that restriction I don't recommend that.

CryptoMorin commented 4 months ago

Thanks!