Hi, i need some enum help. This is also first time i am ever using enums. I have enum and i want to load enum values/paramethers from other classes instead of write value immdetly. I just need it so i can load enum values from config file. This really doesn't have anything to do with bukkit, but might aswell.
Since it is impossible to understand what you want by reading your post, I can guess that you want A: To get a list of all constants in an enum type. B: To get an enum constant from a string To do B, you have to do A, unless you include a redundant field with the constant's name and a constructor in the enum. To get to know how to do this, please look it up and try for yourself. If you still can't get the hang of it, post the code and we'll guide you through it. That's the way it should be working around here.
Just make static variables in a class instead! It works just as enums, you use enums because you want something to be constant, that's why you can't change them or add new ones.
If you want to extract enum values from a config file, do something like this: Code:java EnumType.valueOf(line.toUpperCase()); This will take a String input called "line" and try to turn it into an enum value. Enums are usually all caps (e.g. ENDER_DRAGON), so you need to use toUppercase() first.