-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New command: /makeplugin * #19
Changes from 2 commits
857e8af
8917cfe
4ff6fea
10fa9c7
60df7ca
ac55cb7
225ee7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,25 @@ public function onCommand(CommandSender $sender, Command $command, string $label | |
case "makeplugin": | ||
if(isset($args[0]) and $args[0] === "FolderPluginLoader"){ | ||
return $this->makePluginLoader($sender, $command, $label, $args); | ||
}elseif(isset($args[0]) and $args[0] === "*"){ | ||
$plugins = $this->getServer()->getPluginManager()->getPlugins(); | ||
$succeeded = $failed = []; | ||
foreach($plugins as $plugin){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should check if the loader is a
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since makeplugin doesn't check either I left it as it was - I was more concerned about whether to exclude DevTools itself, or leave it for informational purposes. Edit - I mean that this is checked within makePluginCommand(), so I didn't also add a check for within onCommand(). I've added the check in the latest commit, but this simply silences the error "Plugin DevTools is not in folder structure." |
||
if($this->makePluginCommand($sender, $command, $label, [$plugin->getName()])){ | ||
$succeeded[] = $plugin->getName(); | ||
}else{ | ||
$failed[] = $plugin->getName(); | ||
} | ||
} | ||
if(count($failed) > 0){ | ||
$sender->sendMessage(TextFormat::RED . count($failed) . " plugin" | ||
. (count($failed) === 1 ? "" : "s") . " failed to build: " . implode(", ", $failed)); | ||
} | ||
if(count($succeeded) > 0){ | ||
$sender->sendMessage(TextFormat::GREEN . count($succeeded) . "/" . count($plugins) . " plugin" | ||
. (count($plugins) === 1 ? "" : "s") . " successfully built: " . implode(", ", $succeeded)); | ||
} | ||
return true; | ||
}else{ | ||
return $this->makePluginCommand($sender, $command, $label, $args); | ||
} | ||
|
@@ -146,13 +165,13 @@ private function makePluginCommand(CommandSender $sender, Command $command, stri | |
$pluginName = trim(implode(" ", $args)); | ||
if($pluginName === "" or !(($plugin = Server::getInstance()->getPluginManager()->getPlugin($pluginName)) instanceof Plugin)){ | ||
$sender->sendMessage(TextFormat::RED . "Invalid plugin name, check the name case."); | ||
return true; | ||
return false; | ||
} | ||
$description = $plugin->getDescription(); | ||
|
||
if(!($plugin->getPluginLoader() instanceof FolderPluginLoader)){ | ||
$sender->sendMessage(TextFormat::RED . "Plugin " . $description->getName() . " is not in folder structure."); | ||
return true; | ||
return false; | ||
} | ||
|
||
$pharPath = $this->getDataFolder() . DIRECTORY_SEPARATOR . $description->getName() . "_v" . $description->getVersion() . ".phar"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this has an ALPHA9 requirement? It can be pushed to ALPHA8 without any problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how your bump commit snuck in there...