mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 11:39:43 +00:00
ai changes
This commit is contained in:
parent
4835c15747
commit
5a3aeecd93
9 changed files with 196 additions and 98 deletions
46
src/API/PermissionAPI.php
Normal file
46
src/API/PermissionAPI.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
class PermissionAPI
|
||||
{
|
||||
/**
|
||||
* @var GroupBase[]
|
||||
*/
|
||||
public $groups = [];
|
||||
/**
|
||||
* @var PocketMinecraftServer
|
||||
*/
|
||||
private $server;
|
||||
public function __construct(){
|
||||
$this->server = ServerAPI::request();
|
||||
}
|
||||
public function init(){
|
||||
$this->addGroup(new DefaultGroup());
|
||||
$this->addGroup(new OperatorGroup());
|
||||
}
|
||||
|
||||
public function getGroupByName($name){
|
||||
return $this->groups[$name];
|
||||
}
|
||||
|
||||
public function addGroup(GroupBase $group){
|
||||
if($this->groupExists($group->name)){
|
||||
return false;
|
||||
}
|
||||
$this->groups[$group->name] = $group;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function groupExists($name){
|
||||
return isset($this->groups[$name]);
|
||||
}
|
||||
|
||||
public function removeGroup(GroupBase $group){
|
||||
if(!$this->groupExists($group->name)){
|
||||
return false;
|
||||
}
|
||||
unset($this->groups[$group->name]);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue