Add EventRestriction

This commit is contained in:
Michael Yoo 2013-11-26 20:00:15 +10:30
parent 3352c36ba4
commit 71a1986980
2 changed files with 41 additions and 13 deletions

View File

@ -37,7 +37,10 @@
* Will determine whether that option is set or not.</p>
*/
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.
* Not just an integer variable. Plugins can extend this to have their own Permissions assigned to players.
*/
interface Permission{
/**
* @return integer
*/
public function getPermissionLevel();
//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);
//}
/**
* @param Permission $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
{
/**
* @var string $event
*/
private $event;
/**
* @param array $event
*/
public function __construct($event)
{
$this->event = trim($event);
}
public function __toString()
{
return (string) $this->event;
}
}

View File

@ -60,7 +60,8 @@ class Player{
public $blocked = true;
public $achievements = array();
public $chunksLoaded = array();
public $permissions = array();
/** @var mixed Permissions Object */
public $permissions = false;
private $chunksOrder = array();
private $lastMeasure = 0;
private $bandwidthRaw = 0;