plugin.yml and child permissions

Discussion in 'Plugin Development' started by Bobcat00, Apr 6, 2014.

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

    Bobcat00

    I have the following in my plugin.yml file:
    Code:
    permissions:
        pluginname.debug.*:
            description: Pluginname debug info
            default: false
            children:
                pluginname.debug.events: true
                pluginname.debug.signs: true
        pluginname.debug.events:
            description: Pluginname debug events
            default: false
        pluginname.debug.signs:
            description: Pluginname debug signs
            default: false
    
    The user has the negation permission -pluginname.debug.*
    The user also has '*' (I'm defining the permissions properly).
    I check the permission in my plugin as follows:
    Code:
    if (player.hasPermission("pluginname.debug.signs"))
    
    But this if statement turns out to be true despite the negation. What am I doing wrong?
     
  2. Offline

    BillyGalbreath

    That's not how you properly setup permissions. '*' is the most dangerous thing, which is PEX's biggest mistake and downfall.
     
  3. Offline

    Bobcat00

    OK, but I'm not using PEX, and the way I have the permissions defined works fine for every other plugin.
     
  4. Offline

    AoH_Ruthless

    Bobcat00
    I don't understand the issue. By the laws of the conditional statement, just because you don't have plugin.debug, doesn't mean you also don't have plugin.debug.signs

    What BillyGalbreath is saying is that you shouldn't call the super-permission x.y.z.* - Personally, I just use pluginname.admin, pluginname.mod, etc.. It's a safer practice. Permission Plugins make use of the * node a lot and it is just screwing with your plugin.
     
  5. Offline

    BillyGalbreath

    I misread your question. I see what you're saying now. I'm not sure exactly what the problem is, as everything looks fine syntactically. However, as a side note, this is a different way to do child permissions in plugin.yml (which I prefer because its easier to maintain as a developer) but I dont think you will see any different results with this error:

    Code:
    permissions:
        pluginname.debug.*:
            description: Pluginname debug info
            default: false
            children:
                pluginname.debug.events:
                    description: Pluginname debug events
                    default: false
                pluginname.debug.signs:
                    description: Pluginname debug signs
                    default: false
    
     
  6. Offline

    Bobcat00

    By negating pluginname.debug.*, I expected that testing for plugingname.debug.<anything> to be false.

    Am I doing the test wrong? Do I have to test for
    Code:
    player.hasPermission("pluginname.debug.*") and player.hasPermission("pluginname.debug.signs")
    
    ? Or does it have something to do with the plugin.yml definitions.

    I see some plugins don't even have permissions defined in plugin.yml, and they work.
     
  7. Offline

    AoH_Ruthless

    Bobcat00
    You don't need permissions defined in plugin.yml. And no, you only need to test if player has permission pluginName.debug.signs...

    Using your original method, if the player has pluginName.debug, they will get all the child permissions. But just because a player doesn't have that, doesn't mean they won't have the child permissions. You will have to give yourself -pluginName.debug.signs
     
  8. Offline

    Bobcat00

    With Multiverse, if I have -mv.bypass.gamemode.*, it works out that I don't have mv.bypass.gamemode.world when the plugin tests for it. So it works with Multiverse.

    Now I see that Mutiverse doesn't list the permissions in plugin.yml. So exactly what happens when the permissions are listed?
     
Thread Status:
Not open for further replies.

Share This Page