Deny permission to use a command if no permission is set

Having no permission is almost always a bug. We already have behaviour elsewhere in the core that assumes undefined permission = permission denied.

This behaviour might confuse some people, but I think it's much less dangerous than accidentally allowing everyone to use your command.
This commit is contained in:
Dylan K. Taylor 2023-02-13 14:22:36 +00:00
parent d891646d0a
commit 082f9e1647
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -113,7 +113,7 @@ abstract class Command{
public function testPermissionSilent(CommandSender $target, ?string $permission = null) : bool{
$permission ??= $this->permission;
if($permission === null || $permission === ""){
return true;
return false;
}
foreach(explode(";", $permission) as $p){