user3234065 user3234065 - 9 months ago 91
Java Question

bukkit plugin.yml external var

i have started 1 day ago with scripting java and i am working with bukkit.

my question is how i can get&set values( variables ) into a external file (plugin.yml) ?

like this


commandforx: ABC

if(cmd.getName().equalsIgnoreCase( *commandforx* )) ......

so my target is to get the var commandforx from plugin.yml to

and heres my second question how i can save coordinates?

also set&get the coordinates over the plugin.yml...

thanks ahead

Answer Source

Don't store variables in plugin.yml. Instead you can use the FileConfiguration API that is in the Bukkit API by default! Here is a great tutorial on doing this:

Or alternatively, you can just read and write from a defined file (Tutorials on this are everywhere online) and parse the input. This is more difficult then using the FileConfiguration API, but it's still very simple and gives you more control over the file (I always use this method).