diff --git a/src/DevTools/DevTools.php b/src/DevTools/DevTools.php index 3fd5204..2d5ee63 100644 --- a/src/DevTools/DevTools.php +++ b/src/DevTools/DevTools.php @@ -30,17 +30,16 @@ class DevTools extends PluginBase{ - public function onLoad(){ + public function onEnable(){ + @mkdir($this->getDataFolder()); $this->getServer()->getLoader()->add("FolderPluginLoader", array( $this->getFile() . "src" )); - $this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader"); - $this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader")); - console("[INFO] Registered folder plugin loader"); - } - - public function onEnable(){ - @mkdir($this->getDataFolder()); + if(!class_exists("FolderPluginLoader\\FolderPluginLoader", false)){ + $this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader"); + $this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader")); + console("[INFO] Registered folder plugin loader"); + } } public function onCommand(CommandSender $sender, Command $command, $label, array $args){ @@ -123,7 +122,7 @@ private function makePluginLoader(CommandSender $sender, Command $command, $labe $phar->setSignatureAlgorithm(\Phar::SHA1); $phar->startBuffering(); - $phar->addFromString("plugin.yml", "name: FolderPluginLoader\nversion: 1.0.0\nmain: FolderPluginLoader\\Main\napi: [1.0.0]\n"); + $phar->addFromString("plugin.yml", "name: FolderPluginLoader\nversion: 1.0.0\nmain: FolderPluginLoader\\Main\napi: [1.0.0]\nload: STARTUP\n"); $phar->addFile($this->getFile() . "src/FolderPluginLoader/FolderPluginLoader.php", "src/FolderPluginLoader/FolderPluginLoader.php"); $phar->addFile($this->getFile() . "src/FolderPluginLoader/Main.php", "src/FolderPluginLoader/Main.php"); diff --git a/src/FolderPluginLoader/Main.php b/src/FolderPluginLoader/Main.php index c336cb1..957981a 100644 --- a/src/FolderPluginLoader/Main.php +++ b/src/FolderPluginLoader/Main.php @@ -18,12 +18,17 @@ namespace FolderPluginLoader; use pocketmine\plugin\PluginBase; +use pocketmine\plugin\PluginLoadOrder; class Main extends PluginBase{ public function onLoad(){ + + } + + public function onEnable(){ $this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader"); $this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader")); - console("[INFO] Registered folder plugin loader"); + $this->getServer()->enablePlugins(PluginLoadOrder::STARTUP); } } \ No newline at end of file