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

Universal Permissions

Comments in 'Plugin Development' started by Darunia18, Nov 7, 2013.

  1. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    755
    Plugins:
    2
    Minecraft User:
    Darunia18
    One thing I hate with PocketMine plugins is that there is no universal way to make permissions. Current permissions plugins create the permissions based off of commands, but what I really dream of is permissions plugins accept universal permission nodes like in Bukkit. This could help many different types of plugins be of more use to use permissions rather than commands. I hope one day this becomes a norm in PocketMine plugins. Until then, I will work with whatever I can.
    Falk likes this.
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    This would be awesome!
  3. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    392
    There is an universal way to make permissions, but nobody uses it :(
  4. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    What is that?
  5. wies
    Offline

    wies Notable Member

    Joined:
    Aug 23, 2013
    Posts:
    392
    You can make a permission in your plugin with:
    PHP:
    if($this->api->dhandle($permission$data !== false)){
      
    // Allowed
    }else{
      
    // Rejected
    }
    Then another plugin can allow/reject this with:
    PHP:
    $this->api->addHandler($permission, array($this"hackchecker"));

    public function 
    hackchecker($data){
      if(
    $data === "hacker"){
          return 
    false;
      }else{
          return 
    true;
      }
    }
    $permission is a string with the permission name, for example "hacker.check" but this can be a random string.
    Glitchmaster_PE and Falk like this.
  6. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    755
    Plugins:
    2
    Minecraft User:
    Darunia18
    Wies posted an example in some plugin's thread. I really want devs to use this though!
  7. Darunia18
    Offline

    Darunia18 Staff Member Sectional Moderator

    Joined:
    Aug 23, 2013
    Posts:
    755
    Plugins:
    2
    Minecraft User:
    Darunia18
    Ok you reposted it. Thanks
  8. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,710
    Plugins:
    22
    Minecraft User:
    Falkirknh
    Oh wow that is useful
    Darunia18 likes this.

Share This Page

Advertisement