68 if(count($args) === 0){
69 $sender->sendMessage(
TextFormat::RED .
"Usage: " . $this->usageMessage);
73 $pluginName = trim(implode(
" ", $args));
74 if($pluginName ===
"" or !(($plugin =
Server::getInstance()->getPluginManager()->getPlugin($pluginName)) instanceof Plugin)){
75 $sender->sendMessage(
TextFormat::RED .
"Invalid plugin name, check the name case.");
76 $this->sendPluginList($sender);
81 if(!($plugin->getPluginLoader() instanceof PharPluginLoader)){
87 if(file_exists($folderPath)){
88 $sender->sendMessage(
"Plugin already exists, overwriting...");
93 $reflection = new \ReflectionClass(
"pocketmine\\plugin\\PluginBase");
94 $file = $reflection->getProperty(
"file");
95 $file->setAccessible(
true);
96 $pharPath = str_replace(
"\\",
"/", rtrim($file->getValue($plugin),
"\\/"));
98 foreach(
new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($pharPath)) as $fInfo){
99 $path = $fInfo->getPathname();
100 @mkdir(dirname($folderPath . str_replace($pharPath,
"", $path)), 0755,
true);
101 file_put_contents($folderPath . str_replace($pharPath,
"", $path), file_get_contents($path));
106 | | __ ___ _ __ _ ___ _ _ ___| |__) | __ ___ 107 | | |_ |/ _ \ '_ \| / __| | | / __| ___/ '__/ _ \ 108 | |__| | __/ | | | \__ \ |_| \__ \ | | | | (_) | 109 \_____|\___|_| |_|_|___/\__, |___/_| |_| \___/ 113 $sender->sendMessage($license);
114 $sender->sendMessage(
"Source plugin " .
$description->getName() .
" v" .
$description->getVersion() .
" has been created on " . $folderPath);