Skip to content
This repository was archived by the owner on Jan 9, 2018. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/DevTools/DevTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,20 @@
use pocketmine\plugin\PluginLoadOrder;
use pocketmine\Server;
use pocketmine\utils\TextFormat;
use pocketmine\utils\Config;

class DevTools extends PluginBase implements CommandExecutor{

private $ignorance = array();

public function onLoad(){
$this->getServer()->getCommandMap()->register("devtools", new ExtractPluginCommand($this));
}

public function onEnable(){
@mkdir($this->getDataFolder());


$this->ignorance = (new Config($this->getDataFolder()."pluginignore.yml", Config::YAML))->getAll();

if(!class_exists("FolderPluginLoader\\FolderPluginLoader", false)){
$this->getServer()->getPluginManager()->registerInterface("FolderPluginLoader\\FolderPluginLoader");
$this->getServer()->getPluginManager()->loadPlugins($this->getServer()->getPluginPath(), ["FolderPluginLoader\\FolderPluginLoader"]);
Expand Down Expand Up @@ -186,8 +190,13 @@ private function makePluginCommand(CommandSender $sender, Command $command, $lab
if($path{0} === "." or strpos($path, "/.") !== false){
continue;
}
$phar->addFile($file, $path);
$sender->sendMessage("[DevTools] Adding $path");

if(!in_array($path, $this->ignorance)){
$phar->addFile($file, $path);
$sender->sendMessage("[DevTools] Adding $path");
}else{
$sender->sendMessage("[DevTools] Ignoring $path");
}
}

foreach($phar as $file => $finfo){
Expand Down Expand Up @@ -244,4 +253,4 @@ private function makeServerCommand(CommandSender $sender, Command $command, $lab
return true;
}

}
}