Stumped..

Discussion in 'Plugin Development' started by WesJD, Nov 28, 2014.

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

    WesJD

    So, I'm currently creating a MySQL-based rank system for my network. Right now I'm stumped on how to cast the player to see if they're a rank. Seems like I already know how to do this though I can't figure it out. If you're not understanding, this is what I'm talking about:

    Code:java
    1. if(p.isRank(Rank.OWNER) {
    2. //lala other code
    3. }


    Current code:
    Code:java
    1. public boolean isRank(Rank rank) {
    2. //SQL code checking the rank...
    3. return true;
    4. }


    Thanks in advance.
     
  2. Offline

    teej107

    Maybe your code should accept a player in the parameters since isRank isn't a method for Player.
     
    RingOfStorms likes this.
  3. Offline

    WesJD

  4. Offline

    RingOfStorms

    It seems to me like you are using an enum for ranks, while this sounds cool, it is a horrible idea. Whenever you want to make changes to ranks or permissions it looks like you will be needing to hardcode and then recompile your entire backend. That is fairly inefficient. What you should do is go more of the route of the traditional permissions system and have ranks defined in the sql and then another table with players and their ranks. This allows you to edit permissions on the fly by editing the sql entries, rather than having to hardcode your changes.
     
  5. Offline

    sethrem

    What are you using this method for, like more specifically when are you going to call this method.
     
  6. Offline

    ChipDev

    Don't extend player class, make your own method with the (player) argument
     
Thread Status:
Not open for further replies.

Share This Page