Solved Best way to write alot of permissions?

Discussion in 'Spigot Plugin Development' started by Realm, Apr 28, 2017.

  1. I am developing a plugin, but the plugin has alot of permissions based on a variable.
    Ill explain...
    In the plugin.yml, first of all, do you HAVE to write all the permissions there? I'm not 100% sure of this, I've just always written them there by default...
    Secondly, say I have these permissions:
    pluginname.use
    pluginname.use.<variable>

    The variable is defined, dependant on all different blocks in the game... for example logs, grass... etc
    As you can guess... that's alot of permissions to write in the plugin.yml

    I was wondering if I actually have to do this or not for every single block ;/

    Do I have to do this:

    Code (Text):
    permissions:
        pluginname.use:
            default: op
        pluginname.use.grass:
            default: op
        pluginname.use.log:
            default: op
    #etc....
     
  2. You don't need to put them in the plugin.yml, they will just default to op.
     
  3. Phew... thank god. Thankyou :)
     
  4. I have never put permissions into the plugin.yml at all. Just feels like a waste of time. For me it doesn't change any functionalities. So no, it's definitely not required :D
     
    • Like Like x 1
  5. try something like player.haspermission("block.use" + block.gettype().tostring())

    Typed on phone so will need to edit
     
  6. I knew how to do it, you didnt read my post properly.
     
  7. If you want to configure permissions, f.e. create a pluginname.use.*, you can also register them through code (afaik you'd create a new Permission instance, and call PluginManager::addPermission(Permission))