diff --git a/src/pocketmine/permission/PermissibleBase.php b/src/pocketmine/permission/PermissibleBase.php index 1f627785b..bec0fab46 100644 --- a/src/pocketmine/permission/PermissibleBase.php +++ b/src/pocketmine/permission/PermissibleBase.php @@ -30,7 +30,7 @@ use pocketmine\timings\Timings; class PermissibleBase implements Permissible{ /** @var ServerOperator */ - private $opable = null; + private $opable; /** @var Permissible */ private $parent = null; @@ -59,24 +59,14 @@ class PermissibleBase implements Permissible{ * @return bool */ public function isOp() : bool{ - if($this->opable === null){ - return false; - }else{ - return $this->opable->isOp(); - } + return $this->opable->isOp(); } /** * @param bool $value - * - * @throws \Exception */ public function setOp(bool $value){ - if($this->opable === null){ - throw new \LogicException("Cannot change op value as no ServerOperator is set"); - }else{ - $this->opable->setOp($value); - } + $this->opable->setOp($value); } /** diff --git a/src/pocketmine/plugin/PluginManager.php b/src/pocketmine/plugin/PluginManager.php index 861ea2e1a..a709e253d 100644 --- a/src/pocketmine/plugin/PluginManager.php +++ b/src/pocketmine/plugin/PluginManager.php @@ -596,11 +596,7 @@ class PluginManager{ * @return bool */ public function isPluginEnabled(Plugin $plugin) : bool{ - if($plugin instanceof Plugin and isset($this->plugins[$plugin->getDescription()->getName()])){ - return $plugin->isEnabled(); - }else{ - return false; - } + return isset($this->plugins[$plugin->getDescription()->getName()]) and $plugin->isEnabled(); } /** @@ -669,7 +665,7 @@ class PluginManager{ }elseif(is_string($data["permission"])){ $newCmd->setPermission($data["permission"]); }else{ - throw new \InvalidArgumentException("Permission must be a string or boolean, " . gettype($data["permission"] . " given")); + throw new \InvalidArgumentException("Permission must be a string or boolean, " . gettype($data["permission"]) . " given"); } }