Adding Permissions. Help.

Discussion in 'Plugin Development' started by TheLazeboy, Jan 2, 2013.

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

    TheLazeboy

    How can I set the permission to false in my "Permissions" class? Meaning only those with the node can use the command.
     
  2. Offline

    Jogy34

    change them to new Permission("your.permission", PermissionDefault.FALSE);
     
  3. Offline

    EnvisionRed

    If you've got a dedicated class for Permissions, why not just make them all static so you don't have to instantiate an instance of the Permissions class whenever you want to register a permission?
     
  4. Offline

    TheLazeboy

    Here is my permissions class,
    Code:
    package me.TheLazeboy.superpowers;
     
    import org.bukkit.permissions.Permission;
    import org.bukkit.permissions.PermissionDefault;
     
    public class Permissions {
       
        public Permission heal = new Permission("superpowers.heal", PermissionDefault.FALSE);
    }
    
     
  5. Offline

    EnvisionRed

    And?
     
  6. Offline

    TheLazeboy

    I still have access to the command, while I'm not in a group with the permission. How can I do that? I' m not op'd. And where do I put the instances?
     
  7. Offline

    Jogy34

    Did you actually check if the player using the command has the permission before doing anything?

    Also he meant to add static after public so that you can access them from anywhere without needing an instance of the class
     
  8. Offline

    TheLazeboy

    Using PEX, here is the permissions.yml,
    Code:
    groups:
      NotSpecial:
        prefix: '&3(&3NotSpecial&3)&7 '
        default: true
        permissions:
        - modifyworld.*
        - permissions.*
      Special:
        prefix: '&1(&1Special&1)&7 '
        inheritance: NotSpecial
        default: false
        permissions:
        - modifyworld.*
        - permissions.*
      Healer:
        prefix: '&2(&2Healer&2)&7 '
        inheritance: Special
        default: false
        permissions:
        - modifyworld.*
        - permissions.*
        - superpowers.heal
    users:
      TheLazeboy:
        group:
        - Special
     
  9. Offline

    Jogy34

    For one I was talking about in your onCommand()

    For two don't use PEX it isn't reliable.
     
  10. Offline

    EnvisionRed

    I don't see why your permissions.yml is relevant. He was asking for your java code in your onCommand method which tests the player's permissions before the command is executed.
     
  11. Offline

    TheLazeboy

    I use CommandExecutor class, here is the part whether the player has the permission or not,
    Code:
                    if(sender.hasPermission("superpowers.heal")) {
                        sender.sendMessage(ChatColor.GREEN + "Healed!");
                }else{
                        sender.sendMessage(ChatColor.RED + "Not Healed!!");
    Also, I realize PEX doesn't always work, but are there any other permission plugins I can use, that update frequently? I use it for my main server, too.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 8, 2016
Thread Status:
Not open for further replies.

Share This Page