Permission + configurable number

Discussion in 'Plugin Development' started by ktar5, Sep 25, 2013.

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

    ktar5

    I was wondering if it was possible to, say, have the permission
    "perm.perm" and read that permission and set a value to, 1.
    but if the permission is
    "perm.perm.<insert any number here>" it will read that number and set a value to that number, can i do this without creating a giant amount of different permissions with a number on the end of it?

    Thanks! <3
     
  2. Offline

    remremrem

    Yes. I Haven't tested this, but it should be close

    Code:java
    1. for (PermissionAttachmentInfo perm : player.getEffectivePermissions()) {
    2.  
    3. String permName = perm.getPermission()
    4.  
    5. if (permName.contains("permission.permission.")) {
    6.  
    7. theNumber = permName.split(".")[2]
    8.  
    9. }
    10.  
    11. }
     
Thread Status:
Not open for further replies.

Share This Page