Assigning User Permissions

Discussion in 'Plugin Development' started by dark navi, Feb 21, 2012.

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

    dark navi

    Hey guys, right now I am working on my whitelisting plugin and I was wondering if there is a clean way of giving/revoking bukkitPerms permissions.

    As of right now, I have a really gross function that looks like this:
    Code:
    private void setPermission(String permission, String status)
        {
            this.plugin.getServer().dispatchCommand(this.plugin.getServer().getConsoleSender(), "permissions player setperm " + this.player.getName() + " " + permission + " " +  status);   
        }
    I couldn't find any setPermission functions, I was hoping someone else could shed some insight into this. Thanks!
     
  2. Offline

    dillyg10

    If u want to set permissions, just use the plugin.yml... and to check if player has perms, do player.hasPermission(permission)
    Syntax for plugin.yml
    Code:
    permissions:
      YourPermission.*
          Children:
                YourPermission.perm1:true
         
          YourPermission.perm1:
                default:op
                description:YourDescription
     
  3. Offline

    Superkabii

    I would recommend you look into hooking Vault.
     
  4. Offline

    dark navi

    I don't think you understand, I want to give users permissions.

    I was trying to do that earlier, but I couldn't find any example/tutorials on how to hook into BukkitPerms. Any suggestions?
     
  5. Offline

    Superkabii

    One of the main goals of Vault is to hook all the permissions plugins. You don't need to be plugin-specific, it's designed to allow support for all the permissions plugins including BukkitPerms.
     
  6. Offline

    dillyg10

    I'm confused, do you want to register a specific permission for a specific player?
     
  7. Offline

    TopGear93

    vault is nice but very unpredictable. Sometimes the nodes will work and sometimes it wont.
     
  8. Offline

    dillyg10

    Agreed, just use standard permission system built in with bukkit...
     
  9. Offline

    dark navi

    Alright, thanks! :)

    Yes, on login, I want to sync a user's permissions with their permissions on our community forums.

    I got vault to work, but I am having trouble giving a user permissions for every world. When I use playerAdd(Player, Perm); is goes under the default world, not under the "permissions" tab.

    That may be, but the standard permissions system does not natively support giving users permissions via code.
     
  10. Offline

    dark navi

    I just wanted to revive this thread for a quick moment.

    Many of you have suggested that I use Vault to bridge BukkitPerms, but I would like to inform plugin developers who are fine sticking with BukkitPerms that it isn't a necessary component. They Vault addPerm function is almost identical to mine, as they use console commands to assign permissions:
    Code:
    @Override
    public boolean playerAdd(String world, String player, String permission) {
    if (world != null) {
    permission = world + ":" + permission;
    }
    return plugin.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "permissions player setperm " + player + " " + permission + " true");
    }
    Obviously, this is ridiculous that it necessary to do this when we are just simply trying to assign a permission. I would like to ask (if any Bukkit Devs see this) for a native addPermission function, as the only way to do it currently both is sloppy and fills the console with unnecessary clutter.
     
Thread Status:
Not open for further replies.

Share This Page