mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-20 15:41:33 +00:00
Merge branch 'next-minor' into next-major
This commit is contained in:
@@ -53,16 +53,16 @@ class PermissionParser{
|
||||
"false" => self::DEFAULT_FALSE,
|
||||
];
|
||||
|
||||
private const KEY_DEFAULT = "default";
|
||||
private const KEY_CHILDREN = "children";
|
||||
private const KEY_DESCRIPTION = "description";
|
||||
|
||||
/**
|
||||
* @throws PermissionParserException
|
||||
*/
|
||||
public static function defaultFromString(bool|string $value) : string{
|
||||
if(is_bool($value)){
|
||||
if($value){
|
||||
return "true";
|
||||
}else{
|
||||
return "false";
|
||||
}
|
||||
return $value ? self::DEFAULT_TRUE : self::DEFAULT_FALSE;
|
||||
}
|
||||
$lower = strtolower($value);
|
||||
if(isset(self::DEFAULT_STRING_MAP[$lower])){
|
||||
@@ -84,16 +84,16 @@ class PermissionParser{
|
||||
$result = [];
|
||||
foreach(Utils::stringifyKeys($data) as $name => $entry){
|
||||
$desc = null;
|
||||
if(isset($entry["default"])){
|
||||
$default = PermissionParser::defaultFromString($entry["default"]);
|
||||
if(isset($entry[self::KEY_DEFAULT])){
|
||||
$default = PermissionParser::defaultFromString($entry[self::KEY_DEFAULT]);
|
||||
}
|
||||
|
||||
if(isset($entry["children"])){
|
||||
if(isset($entry[self::KEY_CHILDREN])){
|
||||
throw new PermissionParserException("Nested permission declarations are no longer supported. Declare each permission separately.");
|
||||
}
|
||||
|
||||
if(isset($entry["description"])){
|
||||
$desc = $entry["description"];
|
||||
if(isset($entry[self::KEY_DESCRIPTION])){
|
||||
$desc = $entry[self::KEY_DESCRIPTION];
|
||||
}
|
||||
|
||||
$result[$default][] = new Permission($name, $desc);
|
||||
|
||||
Reference in New Issue
Block a user