Permissions FAQ

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

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


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


    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!
    Sleaker likes this.
  3. 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. 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. 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

    Patrick Crespo

    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.
  7. I think the IllegalArgumentException indicates that you're attempting to register a permission that's already registered.
  8. Offline

    Patrick Crespo

    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.
  9. 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?


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

    EDIT 2: Nope. Didn't get what I wanted.
  10. @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 (Text):
    2. Set<Permission> allPermissions = pm.getDefaultPermissions(false);
    3. allPermissions.addAll(pm.getDefaultPermissions(true));
  11. @Celtic Minstrel : I didn't get any values returned when I used that function.
  12. Offline

    Patrick Crespo

    @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).
  13. @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.
  14. 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)
  15. Well, from the JavaDoc it seems like that's what getDefaultPermissions is intended to do, so... I dunno.
  16. Offline


    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:


    W/Bukkit Permissions:


    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?
  17. I believe worldedit.* should work. Whether wildcards of this sort work generally depends on the plugin they apply to.
  18. Offline


    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
  19. I recall hearing that WorldEdit already did that, but I could be mistaken.
  20. Offline


    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.
  21. Offline


    How do I select what group players go into on first login?
  22. Depends on your group plugin. Go ask in their thread.
  23. 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?
  24. @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 (Text):
    2. HashMap<String, Boolean> allItems = new HashMap<String,Boolean>();
    3. for(Material material : Material.values()) {
    4.     allItems.put("banrecipe." + material.toLowerCase(), true);
    5.     // Or material.getId() if you prefer type permissions
    6. }
    7. Permission perm = new Permission("banrecipe.*", "Permission for crafting all items", PermissionDefault.OP, allItems);
    8. 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.
  25. Offline


  26. 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.
  27. Offline


    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.
  28. Offline


    how excatly would you convert them i need this for my srever
  29. 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.
Thread Status:
Not open for further replies.

Share This Page