Package de.Keyle.MyPet.api.util
Class ItemStrings
java.lang.Object
de.Keyle.MyPet.api.util.ItemStrings
Round-trips a full
ItemStack (including all meta) to and from a paste-safe
one-line string, for storing items in skilltree JSON.
serialize(org.bukkit.inventory.ItemStack) emits a base64: token (lossless, versioned via Paper's
serializeAsBytes). deserialize(java.lang.String) accepts that token, or a plain
data-component / material string (e.g. minecraft:diamond) parsed by
ConfigItem, so simple hand-authored rows work too.
-
Method Summary
-
Method Details
-
serialize
Serialize a full item (incl. meta) to a tokendeserialize(java.lang.String)round-trips.- Parameters:
item- the item to write out- Returns:
- a single-line, paste-safe representation
-
deserialize
Parse a drop-pool item string. Returnsnullfor blank/unparseable input. Abase64:token is decoded losslessly; anything else is delegated toConfigItem(data-component or material string).- Parameters:
data- a string produced byserialize(ItemStack)- Returns:
- the reconstructed item
-