Permissions FAQ

Discussion in 'Plugin Development' started by Dinnerbone, Jul 7, 2011.

  1. Offline

    Skeletor

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME

    I am sharing my opinion, call it flaming if you want but that just shows your ignorance toward others opinions.
  2. Offline

    Skeletor

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Yes while this may be all fine and dandy for developers its a tedious and time consuming process of transferring your permissions and also confusing on what to do.

    How is this in any way simpler? Permissions plugins have to update to superperms and then plugin devs for those plugins have to update to those plugins. Why not have a standard permission system that is reliable that is built in with bukkit, that way only developers only have to update to that built in system and users don't have to deal with confusion and lots of work to get it to work.

    Also, people developing plugins for these permission systems still have to deal with the "fragmentation" of them, the only difference is now the developers of the permission systems have to hook to a new api. How inconclusive. And this still means that there will be like 90 different permissions systems, and that plugin developers will still have to manually include these systems!

    This post has been edited 2 times. It was last edited by Skeletor Aug 5, 2011.
    Sleaker likes this.
  3. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    For me (in General) it was ~290 lines in plugin.yml and ~186 lines of code. :p But that's probably an unusual situation. It was a lot easier with SimpleSignEdit.
  4. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    No-one is forcing you as a server administrator to switch to a different permissions system. You should be able to just keep using whichever one you currently use if that's the one you prefer.
  5. Offline

    petteyg359

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Wrong. That is why it is simpler.
    I no longer give a crap what permission plugin you're using, because Bukkit takes care of it for me. As long as your permission plugin does things properly, it will work. My plugin doesn't depend on X permission plugin, I don't need X to build my plugin, I don't care when X changes versions, and X changing API doesn't affect my plugin in any way.
  6. Offline

    codename_B

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  7. Offline

    Patrick Crespo

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Actually, I think I've singled it out. My 'setupPermissions' method was running during the onEnable call, and I think the PluginManager loads permissions afterwards, rather than before. I was getting IllegalArgumentExceptions after onEnable() when I addPermission'd them just fine during it. Which leads me to the next question, is there a reason why it needs to happen after that call as opposed to before? I mean, things like getDescription.getVersion seem to work just fine during onEnable.

    This post has been edited 1 time. It was last edited by Patrick Crespo Aug 6, 2011.
  8. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I think the IllegalArgumentException indicates that you're attempting to register a permission that's already registered.
  9. Offline

    Patrick Crespo

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Yes, but I was trying to set up permissions that I thought would be loaded already (a command to add extra permissions from items in the configuration during onEnable) but when I tried to get them, they were null rather than the permission. Only when I added them, and debugged it did I notice that the IllegalArgumentExceptions were thrown after the onEnable method finished (My permission adds had finished successfuly before then, so it's not those that were throwing it.) Which means that a function after onEnable was adding the permissions I thought should have existed in the plugin.yml, rather than before the onEnable.

    I mean, I worked around it by just removing the permissions from plugin.yml and everything didn't complain, but I was wondering why that happened after the enable, rather than before.

    This post has been edited 1 time. It was last edited by Patrick Crespo Aug 8, 2011.
  10. Offline

    feildmaster Bukkit Team Member

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I'd like to request the function "getRegisteredPermissions()" which returns the map of all (currently registered) permissions. :) Or even just the key strings. I want the names of all the nodes that are set.

    Maybe a hook where I can read the name of the permission that was set...

    Why? Cuz I want to make BukkitPerms just that much simpler.
    Think about it, especially with the new "Pail" plugin, I could make a gui where operators could give/remove permissions to players without having to look up the permissions. You want bukkit to replace/succeed in permissions @Dinnerbone ? Make it simpler for operators to set permissions to players. ^^

    I mean, I could be ranting about something that already exists.. but I don't know. Don't think this does.


    EDIT: I feel like a noob now.
    Is this it?

    getServer().getPluginManager().getDefaultPermissions(true/false);

    I'll be testing what all I get now... :)

    EDIT 2: Nope. Didn't get what I wanted.

    This post has been edited 4 times. It was last edited by feildmaster Aug 10, 2011.
  11. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Patrick Crespo – Pretty sure that when getPermission returns null it means the permission is not formally registered.

    @feildmaster – Um, it looks like getDefaultPermissions is what you want. Or, more specifically, since you want all registered permissions:

    Code:
    Set<Permission> allPermissions = pm.getDefaultPermissions(false);
    allPermissions.addAll(pm.getDefaultPermissions(true));
    
  12. Offline

    feildmaster Bukkit Team Member

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Celtic Minstrel : I didn't get any values returned when I used that function.
  13. Offline

    Patrick Crespo

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Celtic Minstrel - Right, but they were in the plugin.yml and don't get registered until after the onEnable() method. You can test this by putting a permission in plugin.yml, and monitoring an event (like a block break). In the BlockListener, get your permission that hasn't been "addPermission"'d, but is in your plugin.yml, and you'll see that it's not null. Then try and get the same permission during onEnable() and it will be null.

    That to me means the plugin.yml permissions do get registered, but not until after the plugin is enabled, which isn't the same behavior as other things in the plugin.yml (version, authors).

    This post has been edited 1 time. It was last edited by Patrick Crespo Aug 11, 2011.
  14. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @feildmaster – Then, either it's buggy or you truly don't have any permissions registered. I think the easiest way to check would be to add something to your permissions.yml and then see if that gets returned.

    @Patrick Crespo – Hm. That's interesting, and has the sound of a bug.
  15. Offline

    feildmaster Bukkit Team Member

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Ah, maybe you didn't understand. I want all the registered permissions from ALL plugins. Not just the permissions registered in the single plugin. ;)

    EDIT: Maybe I'll just loop through all the plugins and get them individually... (Could be made MUCH easier if I could just have a function to get them all in the first place. =P)

    This post has been edited 1 time. It was last edited by feildmaster Aug 11, 2011.
  16. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Well, from the JavaDoc it seems like that's what getDefaultPermissions is intended to do, so... I dunno.
  17. Offline

    Drat333

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Since the * wildcard was taken out, do I have to denote EVERY node? Or can I just denote a general parent? For example:

    W/ Permissions Plugin:

    -worldedit.*

    W/Bukkit Permissions:

    -worldedit.

    I REALLY do not want to write out EVERY permissions for plugins like WorldEdit. Is this way feasible, or is there another method that I could use?
  18. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I believe worldedit.* should work. Whether wildcards of this sort work generally depends on the plugin they apply to.
  19. Offline

    samp20

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I'm not quite so sure. I think permissionsBukkit has some special temporary workaround. Otherwise you'll have to wait for WorldEdit to update to the latest version of Bukkit
  20. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I recall hearing that WorldEdit already did that, but I could be mistaken.
  21. Offline

    Drat333

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Well, I was just using WorldEdit as an example, as its the first plugin that came to mind that has a ton of permissions. I use a load of others, like WorldGuard, FalseBook, the list goes on.
  22. Offline

    XZeenon

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    How do I select what group players go into on first login?
  23. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Depends on your group plugin. Go ask in their thread.
  24. Offline

    Relick

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Hey I was planning to add SuperPerms to my plugins, however one of them (BanRecipe) has it's permissions requested depending on the item id. This means when I come to define the permissions in plugin.yml the BanRecipe.* permission's children will have to be defined manually. This also means that added items though ModLoaderMP and (eventually) Spout will not be included within the children.

    Is there any way of making sure all sub nodes are included as true? Or do I just have to ask the server owners to make do and add their custom item manually?
  25. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    @Relick – Don't register the permissions for that in the plugin.yml; register them dynamically on startup. (You should probably also add a check to make sure it happens only in the first call of onEnable.) For example, if the permissions are of the form "banrecipe.itemname", this code would work:
    Code:
    HashMap<String, Boolean> allItems = new HashMap<String,Boolean>();
    for(Material material : Material.values()) {
    	allItems.put("banrecipe." + material.toLowerCase(), true);
    	// Or material.getId() if you prefer banrecipe.id type permissions
    }
    Permission perm = new Permission("banrecipe.*", "Permission for crafting all items", PermissionDefault.OP, allItems);
    Bukkit.getServer().getPluginManager().addPermission(perm);
    (The PermissionDefault part is optional; it ensures all ops will get the permission. Other options are TRUE, FALSE, and NOT_OP.)

    That won't work for Spout or ModLoaderMP items, though. I imagine that it would work for items registered through a Bukkit interface once it gets one for that, but not sure when that'll be. I think if you want to support custom items you should probably have a list of the custom item IDs in your config file and loop through that as well as the built-in ones from Material.

    This post has been edited 1 time. It was last edited by Celtic Minstrel Aug 20, 2011.
  26. Offline

    nick980324

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  27. Offline

    Relick

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Ah thanks @Celtic Minstrel , that helps loads :). I didn't think to use that.

    Yeah, so I'll tell custom item owners to make do (or request it to be added). Using this I don't have to go through the item ids and add more every time there is a new minecraft update.

    This post has been edited 5 times. It was last edited by Relick Aug 20, 2011.
  28. Offline

    Zippy50

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Is there any possible way to have different permissions for different worlds? Say, if you wanted a creative world with give commands, but you also wanted a rp world with out the give commands.
  29. Offline

    rezznov

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    how excatly would you convert them i need this for my srever
    thanks
  30. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Well, it would be possible for you to read a list of additional items from the configuration file.
    You just remove all permissions when changing worlds and then add the new ones.
    That's a hard question to answer. If you've been using Permissions or GroupManager, you'll probably want to ask in the thread of whichever permissions plugin you like best (PermissionsBukkit, PermissionsEx, and bPermissions are the ones I know of). If not, you can create a rudimentary two-group setup using just permissions.yml.

Share This Page