Code:
public class main {
public static void main(String[] args){// MAIN METHOD, to test the code
for (ranks Ranks : ranks.values()) // ENHANCED FOR LOOP, loops through the enum values
System.out.printf("%s\n %d %b\n", Ranks, Ranks.getRights(), Ranks.getDonator()); // Prints out a string (%s), int (%d), boolean(%b)
}
}
enum ranks {
//NAME RANK, PLAYERRIGHTS, ISDONATOR
player(0, false),
moderator(1, false),
administrator(2, false),
owner(3, true),
donator(4, true);
private int playerRights;
private boolean isDonator;
private ranks (int rights, boolean isDon){
rights = playerRights;
isDon = isDonator;
}
public int getRights(){
return playerRights;// RETURNS value of playerRights
}
public boolean getDonator(){
return isDonator;// RETURNS value of isDonator
}
}
I was pretty bored on my vacation so I quickly wrote this for someone who might need it , the main class is just for testing purposes and to see how to call the enum values etc...