mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Command: remove unnecessary getPermission() calls
This commit is contained in:
parent
0df3585c81
commit
58f0ad3e3e
@ -127,7 +127,7 @@ abstract class Command{
|
|||||||
if($this->permissionMessage === null){
|
if($this->permissionMessage === null){
|
||||||
$target->sendMessage($target->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
$target->sendMessage($target->getServer()->getLanguage()->translateString(TextFormat::RED . "%commands.generic.permission"));
|
||||||
}elseif($this->permissionMessage !== ""){
|
}elseif($this->permissionMessage !== ""){
|
||||||
$target->sendMessage(str_replace("<permission>", $this->getPermission(), $this->permissionMessage));
|
$target->sendMessage(str_replace("<permission>", $this->permission, $this->permissionMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -139,11 +139,11 @@ abstract class Command{
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function testPermissionSilent(CommandSender $target) : bool{
|
public function testPermissionSilent(CommandSender $target) : bool{
|
||||||
if(($perm = $this->getPermission()) === null or $perm === ""){
|
if($this->permission === null or $this->permission === ""){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(explode(";", $perm) as $permission){
|
foreach(explode(";", $this->permission) as $permission){
|
||||||
if($target->hasPermission($permission)){
|
if($target->hasPermission($permission)){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user