Code: #------------------------------------------------------------------------ #To enable and disable things write true or false (Only for Scheduler #and PlayerMovement) # #Schematic is the schematic file you want loaded. DO NOT ADD EXTENSION. # #Scheduler is wether or not to use a scheduler for pasting the schematic. #Good for laggy servers with many players. # #SchedulerTime is the time for the scheduler to update (in ticks). #20 Ticks = 1 second. # #PlayerMovement is wether or not to update the schematic everytime you #move. Creates a smooth transaction, but may be laggy #------------------------------------------------------------------------ # WELoader: Schematic: sus1 Scheduler: false SchedulerTime: 5 PlayerMovement: true This is my config, but when I try to get some values from the config nothing happens. This is how I get my values: Code: getConfig().getInt("WELoader.SchedulerTime"); The config saves on reload, so theres nothing wrong there.
It's a confusing class (Haven't made it look prettuh yet :3), so I'm just posting the essentials: Code:java public void loadConfiguration() { saveDefaultConfig(); //this.saveConfig(); this.getConfig().options().copyDefaults(true); } @Override public void onDisable(){ saveDefaultConfig(); } @Override public void onEnable() { Bukkit.getServer().getPluginManager().registerEvents(this, this); loadConfiguration(); }
You can remove the copy defaults in the load config and what will be printed out when you use System.out.println('how you get the integer');
khave In your loadConfiguration() method, this.getConfig().options().copyDefaults(true); is unnecessary. saveDefaultConfig(); copies your config perfectly, word for word. The getConfig().options...(blah blah) does not save your config comments correctly (that is, the comments that are not in the header). This has nothing to do with your config keys, but it's a nice thing to know if you want to comment your config without putting it all in the header. Otherwise, I think a full ("prettuh") class would help for others to debug.
I removed the unnecessary code and came up with this: Code:java @Overridepublic void onDisable(){saveDefaultConfig();} @Overridepublic void onEnable() {Bukkit.getServer().getPluginManager().registerEvents(this, this);saveDefaultConfig();} This is what I use in my onCommand: Code:java if(!getConfig().getBoolean("WELoader.Scheduler")){return true;} I tried posting the value of WELoader.Scheduler and it came out null, so clearly it can't recognize my path D; EDIT: Sorry I tried messing with it and found out you guys helped me correctly and it was my other code which was not working xP. Thanks for the help guys!