Hello SpigotMC.org community. Today I have started a new plugin and I tried to generate the config.yml. Surprisingly when I opened the folder in my Plugins folders in my server I realized that the config.yml was uncompleted and never happened to me... This is the code related to the creation of the config.yml file: Code (Text): package com.gmail.private; import org.bukkit.Bukkit; import org.bukkit.plugin.java.JavaPlugin; /** * Created by MrJan01 on 24/04/2017. */ public class Main extends JavaPlugin { public static JavaPlugin GetMain; public void onEnable() { System.out.println("-------------------------------"); System.out.println("AINCRAFT CORE ADDON"); System.out.println("-------------------------------"); GetMain = this; getCommand("AincraftLogin").setExecutor(new Commands()); Bukkit.getServer().getPluginManager().registerEvents(new Events(), this); getConfig(); saveConfig(); } I attached also a screen capture of the project ( on IntelliJ ) Thank you.
Why did you run getConfig if you're not what it returns And why did you use saveConfig if you didn't set any values
1) getConfig() at the line 21 has no sense. 2) saveConfig() copies exactly what is written in your config.yml in your plugin's .jar file. Check if you get any Exception on your logs.
No, loadConfig() doesn't exist. Maybe you meant reloadConfig() but it's useless because the config is loaded at the startup by default.
This does what you want, it saves a default config, but if it exists it doesn't overwrite the existing file. Code (Java): saveResource("config.yml", false) There's also Code (Java): getConfig().options.copyDefaults(true); saveConfig();
Thank you! One think that worked for me was put SaveDefaultConfig(); and SaveConfig(); I hope help others!