Ranks Enum Help...

Discussion in 'Plugin Development' started by Shxke, Nov 23, 2017.

Thread Status:
Not open for further replies.
  1. Offline

    Shxke

    Hello there. I currently am making a MySQL ranks system. I have ranks setup with a hashmap and enums. When the player joins, it adds the player to the hashmap with the string rank he gets from MySQL. I then check the players rank with if (p.getRank().equals(OWNER.toString()) then it would make his prefix the prefix of the rank. If you can help me make this alot simpler, how would i be able to select a enum that has a certain name? Like how would i be able to get an enum value with the name "OWNER"
     
  2. Offline

    Caderape2

    @Shxke Loops enum values and compare the names.
    And for get a string value of an enum, use 'ENUM.name()'
     
  3. Code? Also just assign each enum a string to it, or even better make your getRank method return your Rank enum.

    if(getRank(p).equals(Rank.OWNER)){
    //do stuff
    }
     
Thread Status:
Not open for further replies.

Share This Page