Varying Permissions.

Discussion in 'Plugin Development' started by jakeyray18, Sep 26, 2013.

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

    jakeyray18

    Ok, so pretty much I have a cool down all written up for a command of mine and I wanted to add in a setup for a permission to be something like "plugin.cooldown.45" where 45 would be the cool downtime, however I want it to be changeable so it would be "plugin.cooldown.<int>" where the int could be anything.

    Any help would be appreciated.
    ~Jakey
     
  2. Offline

    chasechocolate

    There's probably a better way, but you could do: Integer.valueOf(perm.replaceAll("plugin.cooldown.", "")).
     
  3. Offline

    jakeyray18

    chasechocolate
    Ok so I think I get how to get the value from the permission but how would I check to see if they have the permission because it is always changing so I cannot match the whole permission? Can it match partial permissions? such as:
    Code:java
    1. if(user.hasPermission("plugin.cooldown.")) {
    2. //code
    3. } else {
    4. //more code
    5. }
    6.  

    Would that match the partial permission or would it not finf them as havng the permission because there is no permission that is just "plugin.cooldown."?

    Sorry not trying to bug you just never attempted to use a permission with a variable in it before.
     
  4. Offline

    jakeyray18

    Bump, still need a hand with this.
     
Thread Status:
Not open for further replies.

Share This Page