Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

get what the perm the player has

Comments in 'Plugin Development' started by BalAnce, Jul 31, 2015.

  1. BalAnce
    Offline

    BalAnce Active Member

    Joined:
    Mar 10, 2015
    Posts:
    125
    Minecraft User:
    BalAnce
    so say i have permission: thisplugin.command.1 or thisplugin.command.5 and so on.
    How would i get what number they have 1 or 5 or whatever. Hope that makes sense.
    64FF00 likes this.
  2. 64FF00
    Offline

    64FF00 Active Member Plugin Developer

    Joined:
    May 11, 2014
    Posts:
    297
    Plugins:
    2
    Minecraft User:
    64FF00
    Use PurePerms API (PurePerms::getEffectivePermissions(Player $p)) to get them easily.

    PHP:
       // From PurePerms API

       /**
         * @param Player $player
         * @return array
         */
        
    public function getEffectivePermissions(Player $player)
        {
            
    $permissions = [];
        
            foreach(
    $player->getEffectivePermissions() as $attachmentInfo)
            {
                
    $permission $attachmentInfo->getPermission();
            
                
    $value $attachmentInfo->getValue();
            
                
    $permissions[$permission] = $value;
            }
        
            
    ksort($permissions);
        
            return 
    $permissions;
        }
    BalAnce and jojoe77777 like this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Monopoly :p
    64FF00 likes this.
  4. Xenturio
    Offline

    Xenturio Active Member

    Joined:
    Sep 19, 2014
    Posts:
    333
    Minecraft User:
    Xenturio
    this was an awesome minigame idea :p:D:D:D
  5. 64FF00
    Offline

    64FF00 Active Member Plugin Developer

    Joined:
    May 11, 2014
    Posts:
    297
    Plugins:
    2
    Minecraft User:
    64FF00
    That's why we need NumericRanks xD
    PEMapModder likes this.
  6. BalAnce
    Offline

    BalAnce Active Member

    Joined:
    Mar 10, 2015
    Posts:
    125
    Minecraft User:
    BalAnce
    Can I have a example
  7. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    Dude it will return array with what permissions player have i supose u need to do in_array()
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    I'll need you to help debug :p I suck with permission management. I can't even setup a Jenkins server :/
    64FF00 likes this.

Share This Page

Advertisement