You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YAML API is a specialized library that simplifies working with YAML configuration files in Bukkit/Spigot/Paper plugins. It provides a robust and consistent interface for loading, saving, updating, and managing YAML-based configurations, along with advanced mapping capabilities for configuration sections and configurable units.
4
+
5
+
---
6
+
7
+
## Overview
8
+
9
+
The **YAML API** package offers a set of tools designed to handle YAML configuration files efficiently. It abstracts the complexity of file I/O and reflection-based configuration parsing, allowing you to focus on using configuration data in your plugin.
10
+
11
+
Key components include:
12
+
13
+
- **YAMLFile**: A class to load, save, and update YAML configuration files.
14
+
- **ResourceUtils**: Utility methods for handling resources and file operations.
15
+
- **Configurable & ConfigurableFile**: Interfaces and classes that provide easy access to the underlying `FileConfiguration`.
16
+
- **ConfigurableUnit**: An interface representing a configuration unit, useful for handling permissions or groups in the configuration.
17
+
- **Mappable, SectionMappable, UnitMappable & HashMappable**: A set of interfaces and classes for mapping configuration sections and units into Java collections.
18
+
- **YAMLUpdater**: A class that updates YAML files by merging default values and preserving comments.
19
+
20
+
---
21
+
22
+
## Key Features
23
+
24
+
- **Unified Configuration Management**:
25
+
Provides a consistent API for reading, writing, and updating YAML configuration files.
26
+
27
+
- **Dynamic Mapping and Conversion**:
28
+
Supports mapping configuration sections to custom units and collections, making it easier to work with complex configuration structures.
29
+
30
+
- **Resource and File Utilities**:
31
+
Includes helper classes to simplify file loading, resource saving, and directory management.
32
+
33
+
- **Comment Preservation and Updates**:
34
+
YAMLUpdater handles merging of default configuration values while preserving existing comments.
35
+
36
+
- **Reflection-Based Parsing**:
37
+
Uses reflection to dynamically access configuration sections and values, ensuring compatibility across server versions.
38
+
39
+
---
40
+
41
+
## Usage Example
42
+
43
+
Below is an example demonstrating how to use the YAML API to load, update, and work with configuration files.
**YAML API** is a powerful library for managing YAML configurations in your Bukkit/Spigot/Paper plugins. It streamlines file operations, mapping, and updates while preserving comments and ensuring compatibility across server versions. Whether you are building simple configuration systems or working with complex, nested settings, YAML API provides the tools you need to efficiently manage your plugin’s configuration.
0 commit comments