Skip to content

1.2

Choose a tag to compare

@MrJetby MrJetby released this 16 May 03:14
· 36 commits to master since this release

Serializers

  • Reintroducing support for legacy colorization—and more!
# Available serializers:
# LEGACY_AMPERSAND  - "&c&lExample &c&9Text"
# LEGACY_SECTION    - "§c§lExample §c§9Text"
# MINI_MESSAGE      - "<bold><red>Example</red> <blue>Text</blue></bold>"
# GSON              - "[{"text":"Example","bold":true,"color":"red"},{"text":" Text","color":"blue"}]"
# PLAIN             - "Example Text"
# MINIMAL           - &l#RGBExample <#RGB>Text</#RGB>
# UNIFIED - Include all, except GSON
serializer:
type: UNIFIED
cache:
enabled: true
max-size: 500
  • Usage: Serializer.TYPE.deserialize(String) → Component
  • Cache: When cache: true, duplicate strings are not re-serialized—the component is retrieved from an LRU cache (default size: 500 entries).
  • Cache Preloading (Warm-up):
List<String> messages = config.getStringList("messages");
Serializer.UNIFIED.cacheAll(messages);
  • Dynamically obtaining a serializer (based on the type specified in the config):
SerializerType type = SerializerType.valueOf(config.getString("serializer.type"));
HashedSerializer serializer = Serializer.get(type);

Component component = serializer.deserialize(input);
  • GUIs now include built-in support for these serializers.

Download | Source Code