mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Cleaned up bool comparison mess
This commit is contained in:
@ -77,7 +77,7 @@ abstract class PluginBase implements Plugin{
|
||||
* @return bool
|
||||
*/
|
||||
final public function isEnabled() : bool{
|
||||
return $this->isEnabled === true;
|
||||
return $this->isEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,7 +86,7 @@ abstract class PluginBase implements Plugin{
|
||||
final public function setEnabled(bool $boolean = true){
|
||||
if($this->isEnabled !== $boolean){
|
||||
$this->isEnabled = $boolean;
|
||||
if($this->isEnabled === true){
|
||||
if($this->isEnabled){
|
||||
$this->onEnable();
|
||||
}else{
|
||||
$this->onDisable();
|
||||
@ -98,7 +98,7 @@ abstract class PluginBase implements Plugin{
|
||||
* @return bool
|
||||
*/
|
||||
final public function isDisabled() : bool{
|
||||
return $this->isEnabled === false;
|
||||
return !$this->isEnabled;
|
||||
}
|
||||
|
||||
final public function getDataFolder() : string{
|
||||
@ -110,7 +110,7 @@ abstract class PluginBase implements Plugin{
|
||||
}
|
||||
|
||||
final public function init(PluginLoader $loader, Server $server, PluginDescription $description, $dataFolder, $file){
|
||||
if($this->initialized === false){
|
||||
if(!$this->initialized){
|
||||
$this->initialized = true;
|
||||
$this->loader = $loader;
|
||||
$this->server = $server;
|
||||
@ -210,7 +210,7 @@ abstract class PluginBase implements Plugin{
|
||||
mkdir(dirname($out), 0755, true);
|
||||
}
|
||||
|
||||
if(file_exists($out) and $replace !== true){
|
||||
if(file_exists($out) and !$replace){
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ abstract class PluginBase implements Plugin{
|
||||
}
|
||||
|
||||
public function saveConfig(){
|
||||
if($this->getConfig()->save() === false){
|
||||
if(!$this->getConfig()->save()){
|
||||
$this->getLogger()->critical("Could not save config to " . $this->configFile);
|
||||
}
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ class PluginManager{
|
||||
}
|
||||
}
|
||||
|
||||
if($missingDependency === true){
|
||||
if($missingDependency){
|
||||
foreach($plugins as $name => $file){
|
||||
if(!isset($dependencies[$name])){
|
||||
unset($softDependencies[$name]);
|
||||
@ -325,7 +325,7 @@ class PluginManager{
|
||||
}
|
||||
|
||||
//No plugins loaded :(
|
||||
if($missingDependency === true){
|
||||
if($missingDependency){
|
||||
foreach($plugins as $name => $file){
|
||||
$this->server->getLogger()->critical($this->server->getLanguage()->translateString("pocketmine.plugin.loadError", [$name, "%pocketmine.plugin.circularDependency"]));
|
||||
}
|
||||
@ -430,7 +430,7 @@ class PluginManager{
|
||||
* @return Permission[]
|
||||
*/
|
||||
public function getDefaultPermissions(bool $op) : array{
|
||||
if($op === true){
|
||||
if($op){
|
||||
return $this->defaultPermsOp;
|
||||
}else{
|
||||
return $this->defaultPerms;
|
||||
@ -512,7 +512,7 @@ class PluginManager{
|
||||
* @param Permissible $permissible
|
||||
*/
|
||||
public function subscribeToDefaultPerms(bool $op, Permissible $permissible){
|
||||
if($op === true){
|
||||
if($op){
|
||||
$this->defSubsOp[spl_object_hash($permissible)] = $permissible;
|
||||
}else{
|
||||
$this->defSubs[spl_object_hash($permissible)] = $permissible;
|
||||
@ -524,7 +524,7 @@ class PluginManager{
|
||||
* @param Permissible $permissible
|
||||
*/
|
||||
public function unsubscribeFromDefaultPerms(bool $op, Permissible $permissible){
|
||||
if($op === true){
|
||||
if($op){
|
||||
unset($this->defSubsOp[spl_object_hash($permissible)]);
|
||||
}else{
|
||||
unset($this->defSubs[spl_object_hash($permissible)]);
|
||||
@ -537,7 +537,7 @@ class PluginManager{
|
||||
* @return Permissible[]
|
||||
*/
|
||||
public function getDefaultPermSubscriptions(bool $op) : array{
|
||||
if($op === true){
|
||||
if($op){
|
||||
return $this->defSubsOp;
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,6 @@ class RegisteredListener{
|
||||
* @return bool
|
||||
*/
|
||||
public function isIgnoringCancelled() : bool{
|
||||
return $this->ignoreCancelled === true;
|
||||
return $this->ignoreCancelled;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user