A flexible configuration framework built on top of SimplixStorage, providing thread-safe configuration management with automatic serialization support.
-
🏭 Factory-Based Builder System
- Simplified builder creation via
SimplixBuilderFactory
- Pre-configured settings for common use cases
- Support for file, directory, and path-based configurations
- Automatic reload capabilities
- Simplified builder creation via
-
📦 Serialization Framework
- Automatic serializer registration via
@SimplixSerializerSerializableAutoRegister
- Integration with annotation processing system
- Thread-safe serialization operations
- Support for custom data types
- Automatic serializer registration via
-
🔄 I/O Operations
- Comprehensive file operations through
IOUtil
- Thread-safe file reading and writing
- Directory scanning and management
- File manipulation utilities
- Comprehensive file operations through
dependencies {
implementation("net.legacy.library:configuration:1.0-SNAPSHOT")
}
1️⃣ Create Configuration
// Create a builder with default settings
SimplixBuilder builder = SimplixBuilderFactory.createSimplixBuilder(
"config",
"plugins/MyPlugin"
);
// Create YAML configuration
Yaml config = builder.createYaml();
config.set("server.name", "MyServer");
config.set("server.port", 25565);
2️⃣ Custom Type Serialization
@SimplixSerializerSerializableAutoRegister
public class PlayerDataSerializer implements SimplixSerializable<PlayerData> {
@Override
public PlayerData deserialize(Object obj) {
// Deserialize logic
}
@Override
public Object serialize(PlayerData data) {
// Serialize logic
}
}
3️⃣ File Operations
// Read file content
String content = IOUtil.readFileAsString("config.yml");
// Write to file
IOUtil.writeStringToFile("config.yml", "key: value");
// List all files in directory
List<File> files = IOUtil.getAllFiles("plugins/configs");
SimplixBuilderFactory
: Factory for creating pre-configured builders- Support for multiple formats (YAML, JSON, TOML)
- Automatic reload and comment preservation
- Sorted data storage for consistency
@SimplixSerializerSerializableAutoRegister
: Auto-registration annotationSimplixSerializerSerializableAutoRegisterProcessor
: Registration processor- Integration with SimplixStorage serialization
- Thread-safe operation handling
- File reading and writing operations
- Directory management
- File copying and moving
- Path manipulation utilities
SimplixBuilder builder = SimplixBuilderFactory
.createSimplixBuilderFromFile(new File("config.yml"))
.setDataType(DataType.SORTED)
.setConfigSettings(ConfigSettings.PRESERVE_COMMENTS)
.setReloadSettings(ReloadSettings.AUTOMATICALLY);
// Copy with directory creation
IOUtil.createDirectories("plugins/data");
IOUtil.copyFile("source.yml", "plugins/data/target.yml");
// Batch file processing
List<File> files = IOUtil.getAllFiles("plugins/data");
files.forEach(file -> {
if (IOUtil.getFileExtension(file.getPath()).equals("yml")) {
// Process YAML files
}
});
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
Made with ❤️ by LegacyLands Team