ConfigDTO - Access Yaml via object!
0.0.3An API to easier access your Yaml via an object (ORM)
Config DTO
Wiki | Document | Use As Dependency | Source Code
What is DTO ?
In the field of programming a data transfer object (DTO) is an object that carries data between processes. The motivation for its use is that communication between processes is usually done resorting to remote interfaces (e.g., web services), where each call is an expensive operation.
from wikipedia
This Library let you to access configuration via object related mapping mechanism.
This plugin is fully compatible with kotlin. (caz its written by kotlin :D
Use as Dependency (Maven, Groovy etc)
you can check from here
Features
With this API, you can access the following data in your Yaml:
- primitive type
- collections
- data class
- enumeration
- ConfigurationSerializable Object (ConfigurationSerializable is an interface of bukkit)
How to use
here's the Yaml
name : "John Steven"
family :
- "Eric"
- "Tomas"
- "Mary"
age : 19
weight : 44.3
then create a config class
/*
find the locate inside the resource
if your destination is not same as locate,
you can add copyTo = "your/destination"
*/
@Resource ( locate = "config.yml" )
public class Config extends ConfigFile {
public String name ; //represent the string with path "name"
public List < String > family ; //represent the string list with path "family"
public int age ; //represent the integer with path "age"
public double weight ; //represent the double with path "weight"
@Override
public String toString ( ) {
return "Config{" +
"name='" + name + ' \' ' +
", family=" + family +
", age=" + age +
", weight=" + weight +
'}' ;
}
}
your onEnable():
@Override
public void onEnable() {
ConfigFactory factory = ConfigDTO.Api.getFactory(this); // get config factory with this plugin instance
ConfigManager manager = factory.register(Config.class).dump(); // register the config object
Config cf = manager.getConfig(Config.class); // get the instance of config class
getLogger().info("Config.class -> " + cf.toString()); //verbose
}
the final output:
you can find more on wiki
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta