1.14.4 Get all permissions from every plugin

Discussion in 'Spigot Plugin Development' started by swendel, Feb 26, 2020.

  1. Is there a way to get all the permissions from a plugin? I know you can check the plugin.yml but most plugins don't put permissions in there. Thanks
     
  2. Try iterating over all plugins and then using Plugin#getDescriptionFile#getPermissions on each plugin to add the permissions to a hashmap or list or something later to use.
     
    • Friendly Friendly x 1
  3. yea but that only works for permissions put in the plugins.yml, i'm trying to get every permission
     
  4. So you mean ones using something like PEX?
     
  5. i dont know how pex works but if it gets all the permissions in every plugin then yes
     
  6. Check this out, Im not sure if you are looking for PEX exactly but if you are they have things like this: https://github.com/PEXPlugins/PermissionsEx/wiki/Integrating-with-PEX where you can grab all the permissions from a user

    You may have to do a mixture of using getPermissions from the plugin itself and PermissionsEx, im not too sure where else permissions would bethat you can access unless you load the files from different permission plugins and they use a flat file language that you can deserialize like YAML or JSON to parse
     
  7. thank you but i dont want to use an external plugin
     
  8. You can't really do it, because many plugins don't store their permissions anywhere. Create some custom permission plugin to handle all the permission checks, then cache every permission on these checks. Over time you will have a database with all the permissions.
     
    #8 imDaniX, Feb 26, 2020
    Last edited: Feb 26, 2020