mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-18 19:55:33 +00:00
Add EventRestriction
This commit is contained in:
parent
3352c36ba4
commit
71a1986980
@ -37,6 +37,9 @@
|
|||||||
* Will determine whether that option is set or not.</p>
|
* Will determine whether that option is set or not.</p>
|
||||||
*/
|
*/
|
||||||
class PermissionsAPI{
|
class PermissionsAPI{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -66,16 +69,40 @@ class PermissionsAPI{
|
|||||||
* Each Permission object will be given a level in integer, and it will be this permission object that will be assigned to players.
|
* Each Permission object will be given a level in integer, and it will be this permission object that will be assigned to players.
|
||||||
* Not just an integer variable. Plugins can extend this to have their own Permissions assigned to players.
|
* Not just an integer variable. Plugins can extend this to have their own Permissions assigned to players.
|
||||||
*/
|
*/
|
||||||
interface Permission{
|
//interface RoleInterface{
|
||||||
|
// /**
|
||||||
|
// * @return integer
|
||||||
|
// */
|
||||||
|
// public function getPermissionLevel();
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * @param RoleInterface $permission Permission to check the user for. Must be a an object implementing Permission class.
|
||||||
|
// *
|
||||||
|
// * @return boolean Whether the person has permissions or not.
|
||||||
|
// */
|
||||||
|
// public function isGranted($permission);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//Thinking of doing $player->permissions[] = new EventRestriction("player.move");
|
||||||
|
//$player->permissions->apply(new EventRestriction("player.move"));
|
||||||
|
|
||||||
|
class EventRestriction
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @return integer
|
* @var string $event
|
||||||
*/
|
*/
|
||||||
public function getPermissionLevel();
|
private $event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Permission $permission Permission to check the user for. Must be a an object implementing Permission class.
|
* @param array $event
|
||||||
*
|
|
||||||
* @return boolean Whether the person has permissions or not.
|
|
||||||
*/
|
*/
|
||||||
public function isGranted($permission);
|
public function __construct($event)
|
||||||
|
{
|
||||||
|
$this->event = trim($event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
return (string) $this->event;
|
||||||
|
}
|
||||||
}
|
}
|
@ -60,7 +60,8 @@ class Player{
|
|||||||
public $blocked = true;
|
public $blocked = true;
|
||||||
public $achievements = array();
|
public $achievements = array();
|
||||||
public $chunksLoaded = array();
|
public $chunksLoaded = array();
|
||||||
public $permissions = array();
|
/** @var mixed Permissions Object */
|
||||||
|
public $permissions = false;
|
||||||
private $chunksOrder = array();
|
private $chunksOrder = array();
|
||||||
private $lastMeasure = 0;
|
private $lastMeasure = 0;
|
||||||
private $bandwidthRaw = 0;
|
private $bandwidthRaw = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user