From 13f34a500cd6efdebaed7557c6b3b6d4d07584a6 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 14 Nov 2023 12:59:38 +0000 Subject: [PATCH] PluginBase: clean up inconsistent getter vs property access usages --- src/plugin/PluginBase.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugin/PluginBase.php b/src/plugin/PluginBase.php index 1b537a11c..47ed3add3 100644 --- a/src/plugin/PluginBase.php +++ b/src/plugin/PluginBase.php @@ -70,7 +70,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{ $this->configFile = Path::join($this->dataFolder, "config.yml"); - $prefix = $this->getDescription()->getPrefix(); + $prefix = $this->description->getPrefix(); $this->logger = new PluginLogger($server->getLogger(), $prefix !== "" ? $prefix : $this->getName()); $this->scheduler = new TaskScheduler($this->getFullName()); @@ -145,14 +145,14 @@ abstract class PluginBase implements Plugin, CommandExecutor{ private function registerYamlCommands() : void{ $pluginCmds = []; - foreach(Utils::stringifyKeys($this->getDescription()->getCommands()) as $key => $data){ + foreach(Utils::stringifyKeys($this->description->getCommands()) as $key => $data){ if(str_contains($key, ":")){ - $this->logger->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_commandError($key, $this->getDescription()->getFullName(), ":"))); + $this->logger->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_commandError($key, $this->description->getFullName(), ":"))); continue; } $newCmd = new PluginCommand($key, $this, $this); - if(($description = $data->getDescription()) !== null){ + if(($description = $data->description) !== null){ $newCmd->setDescription($description); } @@ -163,7 +163,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{ $aliasList = []; foreach($data->getAliases() as $alias){ if(str_contains($alias, ":")){ - $this->logger->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_aliasError($alias, $this->getDescription()->getFullName(), ":"))); + $this->logger->error($this->server->getLanguage()->translate(KnownTranslationFactory::pocketmine_plugin_aliasError($alias, $this->description->getFullName(), ":"))); continue; } $aliasList[] = $alias; @@ -181,7 +181,7 @@ abstract class PluginBase implements Plugin, CommandExecutor{ } if(count($pluginCmds) > 0){ - $this->server->getCommandMap()->registerAll($this->getDescription()->getName(), $pluginCmds); + $this->server->getCommandMap()->registerAll($this->description->getName(), $pluginCmds); } } @@ -190,9 +190,9 @@ abstract class PluginBase implements Plugin, CommandExecutor{ * @phpstan-return (Command&PluginOwned)|null */ public function getCommand(string $name){ - $command = $this->getServer()->getPluginCommand($name); + $command = $this->server->getPluginCommand($name); if($command === null || $command->getOwningPlugin() !== $this){ - $command = $this->getServer()->getPluginCommand(strtolower($this->description->getName()) . ":" . $name); + $command = $this->server->getPluginCommand(strtolower($this->description->getName()) . ":" . $name); } if($command instanceof PluginOwned && $command->getOwningPlugin() === $this){