Is setting two parent permissions possible permissions.yml?

Discussion in 'Plugin Development' started by FactBoy, Jul 24, 2020.

  1. Offline

    FactBoy

    I am currently learning about the permissions part of bukkit and I am stuck with this problem. I am testing out a rank type permission where the owner can access all and members does not and here is my permissions.yml file:

    Code:
    server:
        head.*:
            description: You are the server operator.You can do anything.
            children:
                head.swap: true
                head.manhunt: true
                head.plugin_manager: true
                head.share_damage: true
                member: true
        head.swap:
            description: Allows you to launch /deathswap command.
            default: op
        head.manhunt:
            description: Allows you to launch /manhunt command.
            default: op
        head.plugin_manager:
            description: Allows you to manage server's plugins.
            default: op
        head.share_damage:
            description: Allows you to launch /sharedamage command.
            default: op
      
        member.*:
            description: You are a member of a server.
            children:
                member.survival: true
                member.creative: true
        member.survival:
            description: You are permitted to play in survival mode.
            default: true
        member.creative:
            description: You are permitted to play in creative mode.
            default: true
    To know if my permissions.yml is working I tried making a class which changes the the format in chat depending on the rank you have. Below is my listener.

    Code:
    @EventHandler
        public void onChat(AsyncPlayerChatEvent event){
            Player player = event.getPlayer();
            if(player.hasPermission("head")){
                event.setFormat(ownerFormat);
                return;
            }
            else if(player.hasPermission("member")){
                event.setFormat(memberFormat);
                return;
            }
        }   
    
    The problem here is when it checks if a player has a permission of member it produces false and does not format the chat. But when I make myself an operator the formatting works. I tried setting the default to not-op(still does not work). I tried removing the children of member permission and still no luck.
     

Share This Page