Permissions not working

Discussion in 'Plugin Development' started by gabessdsp, Dec 22, 2012.

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

    gabessdsp

    So I've already read through this page:
    http://wiki.bukkit.org/Plugin_Tutorial#Permissions

    and here is my code:
    Code:
    if (player.hasPermission("simplemobcatcher.catch")) {
     
                int blockId = player.getItemInHand().getType().getId();
                if (blockId == 280) {
                    Entity entity = event.getRightClicked();
                    EntityType entity2 = entity.getType();
                    int entity3 = entity2.getTypeId();
     
                    ItemStack give = new ItemStack(383, 1, (short) entity3);
                    player.getInventory().addItem(give);
     
                    player.sendMessage(ChatColor.GOLD + "You have successfully captured a(n) " + ChatColor.AQUA + entity2 + ChatColor.GOLD + ".");
     
                    entity.remove();
                    player.updateInventory();
                }
            }else{
                player.sendMessage(ChatColor.RED + "You don't have permission for that!");
            }
    
    I also defined everything in my plugin.yml for more control and if I set the permission to default: true everything works. But when I give my user a permission using my permissions plugin it doesn;t work.

    In the code above you see I have defined simplemobcatcher.catch is the permission to check for, so I gave my user simplemobcatcher.catch and yet it still doesn't let me do it. It says don't have permission.

    What am I doing wrong?
     
  2. Offline

    fireblast709

    check the case (to be sure)
     
  3. Offline

    ImDeJay

    i had this problem before, and the problem more than likely lies within your plugin.yml

    post it for us please.
     
  4. Offline

    gabessdsp

    fireblast709
    everything is all lower case

    ImDeJay

    Here it is: http://pastie.org/5565444


    and just for good record here is my permissions.yml. I use the latest version of PEX:

    http://pastie.org/5565448
     
  5. Offline

    ImDeJay

    Code:
    name: SimpleMobCatcher
    main: me.Gabriel.SimpleMobCatcher.SMC
    version: 1.1
    description: A Simple Mob Catcher Plugin.
     
    permissions:
      simplemobcatcher.*:
        description: Gives access to all simplemobcatcher commands.
      simplemobcatcher.catch:
        description: Allow
    
    Try that and see if it works. i've never been good with putting permissions in the plugin.yml.
    I'm going to town to go grocery shopping, ill check replies when i get back
     
  6. Offline

    fireblast709

    Try another permissions plugin. PEX has a habit of breaking
     
    gabessdsp likes this.
  7. Offline

    gabessdsp

    fireblast709

    Alright, which plugin would you suggest? I just installed another plugin to check permissions and that didn't work either so PEX is probably the problem.

    Just decided on bPermissions, I really loved PEX so much though :'(

    Now everything is working :) Thanks!

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 30, 2016
  8. Offline

    fireblast709

    np. Hope the PEX devs will fix it
     
Thread Status:
Not open for further replies.

Share This Page