ai changes

This commit is contained in:
GameHerobrine 2022-12-19 20:41:12 +03:00
parent 4835c15747
commit 5a3aeecd93
9 changed files with 196 additions and 98 deletions

46
src/API/PermissionAPI.php Normal file
View 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;
}
}