@@ -392,9 +392,69 @@ YamlConfigurationProperties properties = ConfigLib.BUKKIT_DEFAULT_PROPERTIES.toB
392392 .build();
393393` ` `
394394
395- To get access to this object, you have to import `configlib-paper` instead
395+ If you are using **Paper** software, you can use `PAPER_DEFAULT_PROPERTIES` which includes both Bukkit `ConfigurationSerializable` support (e.g. `ItemStack`) and Adventure support pre-configured :
396+
397+ ` ` ` java
398+ YamlConfigurationProperties properties = ConfigLib.PAPER_DEFAULT_PROPERTIES.toBuilder()
399+ // ...further configure the builder...
400+ .build();
401+ ` ` `
402+
403+ To get access to these objects, you have to import `configlib-paper` instead
396404of `configlib-yaml` as described in the [Import](#import) section.
397405
406+ # ### Support for Adventure library types
407+
408+ The `configlib-adventure` module provides serializers for Adventure library types
409+ commonly used in PaperMC and Velocity plugins. It supports :
410+
411+ * `Component` - Text components with customizable format (MiniMessage, legacy, JSON)
412+ * `Key` - Namespaced keys (e.g., `minecraft:stone`)
413+ * `Sound` - Sound effects with pitch, volume, and source
414+
415+ To use Adventure types in your configuration, use the helper method that registers all Adventure serializers :
416+
417+ ` ` ` java
418+ YamlConfigurationProperties.Builder<?> builder = YamlConfigurationProperties.newBuilder();
419+ AdventureConfigLib.addDefaults(builder);
420+ YamlConfigurationProperties properties = builder.build();
421+ ` ` `
422+
423+ # #### Component Formats
424+
425+ The `AdventureComponentSerializer` supports multiple text formats through the `AdventureComponentFormat` enum :
426+
427+ | Format | Description | Example |
428+ |---------------------|----------------------------------------------------|------------------------------------|
429+ | `MINI_MESSAGE` | MiniMessage tags | `<red>Hello <bold>World</bold>` |
430+ | `LEGACY_AMPERSAND` | Legacy colors with `&` | `&cHello &lWorld` |
431+ | `LEGACY_SECTION` | Legacy colors with `§` | `§cHello §lWorld` |
432+ | `MINECRAFT_JSON` | Minecraft JSON format | `{"text":"Hello","color":"red"}` |
433+ | `TRANSLATION_KEY` | Translation keys | `block.minecraft.stone` |
434+
435+ You can customize the serialization and deserialization format order :
436+
437+ ` ` ` java
438+ List<AdventureComponentFormat> serializeOrder = List.of(AdventureComponentFormat.MINI_MESSAGE);
439+ List<AdventureComponentFormat> deserializeOrder = List.of(
440+ AdventureComponentFormat.MINI_MESSAGE,
441+ AdventureComponentFormat.LEGACY_AMPERSAND
442+ );
443+ AdventureConfigLib.addDefaults(builder, serializeOrder, deserializeOrder);
444+ ` ` `
445+
446+ # #### Sound Serialization
447+
448+ Sounds are serialized in a compact string format : ` <sound_id> [pitch] [volume] [source]` .
449+ Sound id can be anything even it is not in vanilla Minecraft to support custom sound from texture packs.
450+ ` ` ` yaml
451+ # Full format
452+ joinSound: "minecraft:entity.experience_orb.pickup 1.0 1.0 MASTER"
453+
454+ # Minimal format (defaults: pitch=1.0, volume=1.0, source=MASTER)
455+ leaveSound: "minecraft:entity.experience_orb.pickup"
456+ ` ` `
457+
398458# ## Comments
399459
400460The configuration elements of a configuration type can be annotated with
@@ -1141,6 +1201,10 @@ This project contains three classes of modules:
11411201* The `configlib-yaml` module contains the classes that can save configuration
11421202 instances as YAML files and instantiate new instances from such files. This
11431203 module does not contain anything Minecraft related, either.
1204+ * The `configlib-adventure` module provides serializers for Adventure library types
1205+ like `Component`, `Key`, and `Sound`. This module is useful for PaperMC and
1206+ Velocity plugins that use the Adventure text API. See the
1207+ [Adventure support section](#support-for-adventure-library-types) for details.
11441208* The `configlib-paper`, `configlib-velocity`, and `configlib-waterfall` modules
11451209 contain basic plugins that are used to conveniently load this library. These
11461210 three modules shade the `-core` module, the `-yaml` module, and the YAML
0 commit comments