I've used the old Configuration method PHP: public Configuration config; but as it's covered with a line , I suppose bukkit will delete/remove it completly soon. I can copy/paste some code here: This is my defined config methods: PHP: public Configuration config; public Boolean configBoolean; public String configString; public Integer configInt; But if I use PHP: public FileConfiguration config; and still keep this: PHP: configBoolean = config.getBoolean("La.lo-la", true); Will it work? And how would I then load the config? as PHP: config.load(); Is getting a red line, and I don't seem to find how to load it. Anyone?
Code:java final FileConfiguration config = this.getConfig(); config.options().header("Yo this is a header example"); config.addDefault("Example.Boolean", true); config.addDefault("Example.String", "Exampling it up"); config.addDefault("Example.Int", 5); config.options().copyDefaults(true); saveConfig(); Note: You need the Code:java config.options().copyDefaults(true); saveConfig(); For it to make the config file. And to get those booleans, strings and ints. Code:java config.getBoolean("Example.Boolean");config.getInt("Example.Int");config.getString("Example.String"); And example use for the boolean Code:java if (config.getBoolean("Example.Boolean")) {//Do stuff if boolean is true}else{//Do other stuff instead} And to set things like in a command or whatever. Code:java config.set("Example.String", "Changing it to another example string"); saveConfig();
@theguynextdoor Damnit, means I have to change the whole f'ing plugin then.. this can take some time..
Dont worry, i rather like the new config, and it is rather simple when you get the hang of it. But then again, i only recently starting developing plugins, and so i only started using the new config stuff when it was new.