Rename PluginLoadOrder -> PluginEnableOrder

this more accurately describes its real purpose.
This commit is contained in:
Dylan K. Taylor 2020-11-09 20:28:08 +00:00
parent 6cf875ca3a
commit 463bc044df
3 changed files with 10 additions and 10 deletions

View File

@ -69,7 +69,7 @@ use pocketmine\player\Player;
use pocketmine\plugin\PharPluginLoader; use pocketmine\plugin\PharPluginLoader;
use pocketmine\plugin\Plugin; use pocketmine\plugin\Plugin;
use pocketmine\plugin\PluginGraylist; use pocketmine\plugin\PluginGraylist;
use pocketmine\plugin\PluginLoadOrder; use pocketmine\plugin\PluginEnableOrder;
use pocketmine\plugin\PluginManager; use pocketmine\plugin\PluginManager;
use pocketmine\plugin\PluginOwned; use pocketmine\plugin\PluginOwned;
use pocketmine\plugin\ScriptPluginLoader; use pocketmine\plugin\ScriptPluginLoader;
@ -976,7 +976,7 @@ class Server{
register_shutdown_function([$this, "crashDump"]); register_shutdown_function([$this, "crashDump"]);
$this->pluginManager->loadPlugins($this->pluginPath); $this->pluginManager->loadPlugins($this->pluginPath);
$this->enablePlugins(PluginLoadOrder::STARTUP()); $this->enablePlugins(PluginEnableOrder::STARTUP());
foreach((array) $this->configGroup->getProperty("worlds", []) as $name => $options){ foreach((array) $this->configGroup->getProperty("worlds", []) as $name => $options){
if($options === null){ if($options === null){
@ -1025,7 +1025,7 @@ class Server{
$this->worldManager->setDefaultWorld($world); $this->worldManager->setDefaultWorld($world);
} }
$this->enablePlugins(PluginLoadOrder::POSTWORLD()); $this->enablePlugins(PluginEnableOrder::POSTWORLD());
$this->network->registerInterface(new RakLibInterface($this)); $this->network->registerInterface(new RakLibInterface($this));
$this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp(), $this->getPort()])); $this->logger->info($this->getLanguage()->translateString("pocketmine.server.networkStart", [$this->getIp(), $this->getPort()]));
@ -1258,14 +1258,14 @@ class Server{
} }
} }
public function enablePlugins(PluginLoadOrder $type) : void{ public function enablePlugins(PluginEnableOrder $type) : void{
foreach($this->pluginManager->getPlugins() as $plugin){ foreach($this->pluginManager->getPlugins() as $plugin){
if(!$plugin->isEnabled() and $plugin->getDescription()->getOrder()->equals($type)){ if(!$plugin->isEnabled() and $plugin->getDescription()->getOrder()->equals($type)){
$this->pluginManager->enablePlugin($plugin); $this->pluginManager->enablePlugin($plugin);
} }
} }
if($type->equals(PluginLoadOrder::POSTWORLD())){ if($type->equals(PluginEnableOrder::POSTWORLD())){
$this->commandMap->registerServerAliases(); $this->commandMap->registerServerAliases();
} }
} }

View File

@ -80,7 +80,7 @@ class PluginDescription{
private $website = ""; private $website = "";
/** @var string */ /** @var string */
private $prefix = ""; private $prefix = "";
/** @var PluginLoadOrder */ /** @var PluginEnableOrder */
private $order; private $order;
/** @var Permission[] */ /** @var Permission[] */
@ -146,12 +146,12 @@ class PluginDescription{
if(isset($plugin["load"])){ if(isset($plugin["load"])){
try{ try{
$this->order = PluginLoadOrder::fromString($plugin["load"]); $this->order = PluginEnableOrder::fromString($plugin["load"]);
}catch(\InvalidArgumentException $e){ }catch(\InvalidArgumentException $e){
throw new PluginException("Invalid Plugin \"load\""); throw new PluginException("Invalid Plugin \"load\"");
} }
}else{ }else{
$this->order = PluginLoadOrder::POSTWORLD(); $this->order = PluginEnableOrder::POSTWORLD();
} }
$this->authors = []; $this->authors = [];
@ -281,7 +281,7 @@ class PluginDescription{
return $this->name; return $this->name;
} }
public function getOrder() : PluginLoadOrder{ public function getOrder() : PluginEnableOrder{
return $this->order; return $this->order;
} }

View File

@ -33,7 +33,7 @@ use pocketmine\utils\EnumTrait;
* @method static self STARTUP() * @method static self STARTUP()
* @method static self POSTWORLD() * @method static self POSTWORLD()
*/ */
final class PluginLoadOrder{ final class PluginEnableOrder{
use EnumTrait; use EnumTrait;
protected static function setup() : void{ protected static function setup() : void{