Yamler
Yamler

This API enables you the easy usage of Java Object bound into YAML. It works like BungeeYAML but this does not rely on Bukkit Configuration APIs and has some features stripped away.

!!! Also works in Bukkit/Spigot !!!
You will find the BungeeCord Version in this Resource.
The Bukkit Version is on DBO or you can get it via Jenkins.
Jenkins: http://ci.md-5.net/job/Yamler/

How to use it:
1. Create a Class which extends net.cubespace.Yamler.Config.Config
2. Create Fields which are either public or private (not final or transient or static)
3. Create a Constructor and set the CONFIG_FILE and CONFIG_HEADER (CONFIG_HEADER is optional)
4. To tell the Config to load invoke Config.init()

So you end up having a Config Class like this:
Code (Java):
@Getter
@Setter
public class Database extends Config {
public Database(Plugin plugin) {
CONFIG_HEADER = new String[]{"Configuration of the Database"};
CONFIG_FILE = new File(plugin.getDataFolder(), "db.yml");
}

@Comments({
"This is the URL of the Database",
"Must be jdbc:<database engine>:<connection parameter>",
"For H2 (which is the default file based DB): jdbc:h2:{DIR}thesuit.db",
"For MySQL: jdbc:mysql://<host>:<port>/<database>"
})
private String Url = "jdbc:h2:{DIR}thesuit.db";

@Comment("The Username which should be used to auth against the Database")
private String Username = "test";

@Comment("The Password for the User")
private String Password = "test";
}
You can use it with this:
Code (Java):
Database dbConfig = null;
try {
dbConfig = new Database(this);
dbConfig.init();
} catch(InvalidConfigurationException ex) {
System.out.println("Your Config YML was wrong");
ex.printStackTrace();
}
To save a Config file:
Code (Java):
try {
dbConfig.save();
} catch(InvalidConfigurationException ex) {
System.out.println("Error in saving the Config YML");
ex.printStackTrace();
}
Author
Wifi
Downloads
0
Views
117
First release
Last update

Ratings

0.00 star(s) 0 ratings

More resources from Wifi

  • Eclipse Sovereign
    Eclipse Sovereign
    Animated weapons, tools, 3D armor and wings. Included with BlackSpigot ULTRA
  • Halloween Ghost
    Halloween Ghost
    Animated weapons, tools, armor and cosmetics. Included with BlackSpigot ULTRA
  • Yeti Mobs
    Yeti Mobs
    Four animated RPG yetis with MythicMobs and ModelEngine configs. Included with BlackSpigot ULTRA
  • Equipment [Beetle]
    Equipment [Beetle]
    Beetle armor, axe and Nexo elytra with drag-and-drop configs. Included with BlackSpigot ULTRA
  • Autumn Travel Cosmetics【Dyeable】
    Autumn Travel Cosmetics【Dyeable】
    Dyeable autumn beret, scarf, travel case and acorn lantern balloon. Included with BlackSpigot ULTRA
Top