Solved Help with permissions

Discussion in 'Spigot Plugin Development' started by fishy_ydrib, Jan 16, 2020.

  1. Hello!
    I am making a plugin, and I am trying to make permissions. I have already defined the permissions in my plugin.yml.
    The problem is I want a permissions system somewhat like the one below:
    Code (Text):

    -randomperm.*
    ---randomperm.<something>
     
    <something> can be anything from a list defined in the config.yml file. If I use the following code, I can check if the player has the randomperm.<something> or randomperm.*, but it will still return true if a player has randomperm.*, but has randomperm.<something> negated.

    Code (Java):
    if (player.hasPermission("randomperm.*") || player.hasPermission("randomperm." + something)) {
        doSomething();
    }
    I was wondering if there is anything I can do to fix this. Perhaps check if the permission is negated somehow?
     
  2. SteelPhoenix

    Moderator

    don't check for "randomperm.*". A proper permissions plugin will check that for you when checking "randomperm.<something>"
     
    • Informative Informative x 1
  3. Ok, I'll try that out, thanks. Although I heard (a year or so ago) that it's the plugin's job to check for wildcard permissions
     
  4. nope. wildcards are a part of permission plugins.
     
    • Like Like x 1
  5. Thank you so much for the help!