Permissions

Discussion in 'Plugin Development' started by chriztopia, Aug 30, 2013.

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

    chriztopia

    I have been looking for a tutorial or even examples on the beat way to do non specific permissions. Such as perm.land.300 with the 300 being a customizable amount. I would like a simple example of code and how to properly setup the plugin.yml to use this. Any help is helpful.
     
  2. Offline

    xxMOxMOxx

    I haven't tested this ye but heres some code I came up with to get a permission value between 0 and 100




    public int getPercent(Player player){
    int chance = this.getConfig().getInt("beheadchance");
    for(int i = chance+1;i<100;i++){
    if player.hasPermision("PermHeads.beheadchance."+i.toString() && i>chance){
    chance = i;
    }
    return i;
    }
     
  3. Offline

    chriztopia


    I have not tested this yet but what would I set my plugin.yml as for the permissions?
     
  4. Offline

    xxMOxMOxx

    chriztopia
    Thats the annoying part
    permission.node.1
    permission.node.3
    permission.node.4
    permission.node.5
    permission.node.6
    permission.node.7
    permission.node.8
    etc.
     
  5. Offline

    chriztopia

    now that does suck ok thanks I will test the code later. thanks for all the help.
     
Thread Status:
Not open for further replies.

Share This Page