CU
Features:
- You can create custom named yml files.
- You can save easily your custom files.
- You can save files into folders.
Installation:
- Press the download button and download the file from the github, or there is an external link:
[Link] - Drag and drop the .java file into your project!
- Done!
Tutorial:
Just to know: one CustomYml holds one physical file.
- Make a CustomYml class (or as many as file you want)
public CustomYml worldConfig; - Make a new CustomYml on every server load
public void onEnable(){ worldConfig = new CustomYml(this); //this: your main class } - Add after new CustomYml .createNew()
worldConfig = new CustomYml(this).createNew("FileName"); //there are other options worldConfig = new CustomYml(this).createNew("FileName", true/false); //If you make the second parameter false then the generated config will be empty, if true the plugin will try to copy from .jar and paste .createNew(String folder, String fileName); .createNew(String folder, String fileName, boolean loadFromJar);
Getting the config file:
public CustomYml worldConfig;
public void onEnable(){
worldConfig = new CustomYml(this).createNew("worlds");
}
public void changeSomething(){
worldConfig.getConfig().set("Something", " ");
}
Saving the file:
If you change anything in a file or remove , you need to save it
worldConfig.save();
Reloading the file:
If a user changed anything in the file, for example with text editor, you will need to reload the file.
worldConfig.load();
Best way to store your yamls:
public class Configs {
private static CustomYml classes;
private static CustomYml shop;
public Configs(JavaPlugin plugin) {
classes = new CustomYml(plugin).createNew("class");
shop = new CustomYml(plugin).createNew("shop");
}
public static FileConfiguration getClasses() { return classes.getConfig(); }
public static FileConfiguration getShop() { return shop.getConfig(); }
public static void saveClasses() { classes.save(); }
public static void saveShop() { shop.save(); }
public static void loadClasses() { classes.load(); }
public static void loadShop() { shop.load(); }
}
public class MainClass extends JavaPlugin {
public void onEnable(){
new Configs(this);
}
public void somewhere(){
Configs.getShop(); //You can use your Configs class everywhere, and dont need to create a new instance
}
}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