Home›Java›Mods›CustomYml
ModsJava

CustomYml

Java mod listed for Minecraft 1.10–1.15. Download on the author's site.

⬇ Download on Spigot
Features:
Installation:
  1. Press the download button and download the file from the github, or there is an external link:
    [Link]
  2. Drag and drop the .java file into your project!
  3. Done!
Tutorial:

Just to know: one CustomYml holds one physical file.

  1. Make a CustomYml class (or as many as file you want)
    Code (Java):
    public CustomYml worldConfig ;
  2. Make a new CustomYml on every server load
    Code (Java):
    public void onEnable ( ) {
      worldConfig = new CustomYml ( this ) ; //this: your main class
    }
  3. Add after new CustomYml .createNew()
    Code (Java):
    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:
Code (Java):
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

Code (Java):
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.

Code (Java):
worldConfig. load ( ) ;
Best way to store your yamls:

Code (Java):
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
  }

}
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

CustomYml is a free Minecraft Java mod. Compatible with Minecraft 1.10, 1.11, 1.12, 1.13 and newer. Downloaded 753 times (via Spigot). Download it and open it directly in the game.

Explore more