Solved Giving all permisions

Discussion in 'Plugin Development' started by Konato_K, Jan 29, 2015.

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

    Konato_K

    As we know the concept of "*" permission does not really exist in bukkit, looking through the source code of PermissionsEx I found that they use some fancy reflection to inject a special type of map to handle the Regex stuff in the permissions, but I'd like not to use that.

    Is there any way to giving all the permissions to some player?

    I had two ideas, one is getting the list of all plugins in the server, and adding a permission to the player for each plugin in the forum of "pluginname.*", but not all plugins define this permission or use the exact plugin name.

    The other idea (which actually is better) was to loop through all the permissions in the server (with PluginManager#getPermissions) and use them to set to the player, this it's probably the best idea, but some plugins do not register their permissions and just do checks like "player.hasPermission", which won't make the permission be registered in the case it doesn't exist.

    Is there any way to do this without reflection and still giving the permissions that may not be registered?

    Thanks.
     
  2. Offline

    1Rogue

    Well you can make them OP, which would provide the functionality of having "all permissions" without breaking it by adding permissions that actually restrict your ability to do things.
     
  3. Offline

    Konato_K

    @1Rogue Yeah, I thought of doing that too, but I wanted to see if anyone had a better idea.

    About the restrictive permissions, using the getPermissions method returns Permission objects, so I can check if the permissions it's default given to op, false, and that stuff, so adding only "op" perms will work same as doing setOP
     
  4. Offline

    WesJD

    @Konato_K You could get the command map, and get the permissions of every command.
     
  5. Offline

    Konato_K

    @WesJD This works fine, but some plugins don't define permissions and just use them, as example, let's say I have a minigame, and staff members can join the minigame regardless the game already started or not, so I just check if they have the permission, but the permission it's not registered under the plugin yml and it's not used for any command.

    I think the OP would be the best option as of now.
     
  6. Offline

    xTrollxDudex

    Provide the permission upon request?
     
  7. Offline

    Konato_K

    I guess for now I'll go with the OP option, thanks for the feedback though :)
    If something explodes I'll make a thread later.

    Solved.
     
Thread Status:
Not open for further replies.

Share This Page