mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-14 15:35:31 +00:00
Permission: Throw exception on unknown values in getByName()
Previously, writing wrong values into plugin.yml for permission defaults would cause the permission to be silently denied to everyone.
This commit is contained in:
parent
75482124f2
commit
acd7c9b336
@ -42,6 +42,8 @@ class Permission{
|
||||
* @param bool|string $value
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function getByName($value) : string{
|
||||
if(is_bool($value)){
|
||||
@ -70,10 +72,11 @@ class Permission{
|
||||
|
||||
case "true":
|
||||
return self::DEFAULT_TRUE;
|
||||
|
||||
default:
|
||||
case "false":
|
||||
return self::DEFAULT_FALSE;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException("Unknown permission default name \"$value\"");
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user