Skip to content
This repository was archived by the owner on Jan 9, 2018. It is now read-only.

Commit 2ccd6f2

Browse files
committed
v1.4.1 fixed
1 parent 45c47da commit 2ccd6f2

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/DevTools/DevTools.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,16 @@
3030

3131
class DevTools extends PluginBase{
3232

33-
public function onLoad(){
33+
public function onEnable(){
34+
@mkdir($this->getDataFolder());
3435
$this->getServer()->getLoader()->add("FolderPluginLoader", array(
3536
$this->getFile() . "src"
3637
));
37-
$this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader");
38-
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader"));
39-
console("[INFO] Registered folder plugin loader");
40-
}
41-
42-
public function onEnable(){
43-
@mkdir($this->getDataFolder());
38+
if(!class_exists("FolderPluginLoader\\FolderPluginLoader", false)){
39+
$this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader");
40+
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader"));
41+
console("[INFO] Registered folder plugin loader");
42+
}
4443
}
4544

4645
public function onCommand(CommandSender $sender, Command $command, $label, array $args){
@@ -123,7 +122,7 @@ private function makePluginLoader(CommandSender $sender, Command $command, $labe
123122
$phar->setSignatureAlgorithm(\Phar::SHA1);
124123
$phar->startBuffering();
125124

126-
$phar->addFromString("plugin.yml", "name: FolderPluginLoader\nversion: 1.0.0\nmain: FolderPluginLoader\\Main\napi: [1.0.0]\n");
125+
$phar->addFromString("plugin.yml", "name: FolderPluginLoader\nversion: 1.0.0\nmain: FolderPluginLoader\\Main\napi: [1.0.0]\nload: STARTUP\n");
127126
$phar->addFile($this->getFile() . "src/FolderPluginLoader/FolderPluginLoader.php", "src/FolderPluginLoader/FolderPluginLoader.php");
128127
$phar->addFile($this->getFile() . "src/FolderPluginLoader/Main.php", "src/FolderPluginLoader/Main.php");
129128

src/FolderPluginLoader/Main.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,17 @@
1818
namespace FolderPluginLoader;
1919

2020
use pocketmine\plugin\PluginBase;
21+
use pocketmine\plugin\PluginLoadOrder;
2122

2223
class Main extends PluginBase{
2324

2425
public function onLoad(){
26+
27+
}
28+
29+
public function onEnable(){
2530
$this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader");
2631
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), array("FolderPluginLoader\\FolderPluginLoader"));
27-
console("[INFO] Registered folder plugin loader");
32+
$this->getServer()->enablePlugins(PluginLoadOrder::STARTUP);
2833
}
2934
}

0 commit comments

Comments
 (0)