diff --git a/resources/lang/en_us.json b/resources/lang/en_us.json index 0da640c..00122cb 100644 --- a/resources/lang/en_us.json +++ b/resources/lang/en_us.json @@ -33,5 +33,7 @@ "command.purge.description": "Remove the plugin and it data", "command.purge.failed": "§cPlugin cannot be removed: {{reason}}", - "command.purge.successfully": "§a{{name}} and it data removed successfully" + "command.purge.successfully": "§a{{name}} and it data removed successfully", + + "command.update.description": "Update cache" } diff --git a/src/thebigcrafter/omp/commands/OMPCommand.php b/src/thebigcrafter/omp/commands/OMPCommand.php index ef40c62..9fc7b35 100644 --- a/src/thebigcrafter/omp/commands/OMPCommand.php +++ b/src/thebigcrafter/omp/commands/OMPCommand.php @@ -17,6 +17,7 @@ use thebigcrafter\omp\commands\subcommands\ListCommand; use thebigcrafter\omp\commands\subcommands\PurgeCommand; use thebigcrafter\omp\commands\subcommands\RemoveCommand; +use thebigcrafter\omp\commands\subcommands\UpdateCommand; use thebigcrafter\omp\commands\subcommands\VersionCommand; use thebigcrafter\omp\OhMyPMMP; @@ -31,7 +32,8 @@ protected function prepare() : void { new HelpCommand(OhMyPMMP::getInstance(),"help", OhMyPMMP::getLanguage()->translate("command.help.description"), ["h", "-h", "--help"]), new ListCommand(OhMyPMMP::getInstance(), "list", OhMyPMMP::getLanguage()->translate("command.list.description"), ["l", "-l", "--list"]), new RemoveCommand(OhMyPMMP::getInstance(), "remove", OhMyPMMP::getLanguage()->translate("command.remove.description"), ["r", "-r", "--remove"]), - new PurgeCommand(OhMyPMMP::getInstance(), "purge", OhMyPMMP::getLanguage()->translate("command.purge.description"), ["p", "-p", "--purge"]) + new PurgeCommand(OhMyPMMP::getInstance(), "purge", OhMyPMMP::getLanguage()->translate("command.purge.description"), ["p", "-p", "--purge"]), + new UpdateCommand(OhMyPMMP::getInstance(), "update", OhMyPMMP::getLanguage()->translate("command.update.description"), ["u", "-u", "--update"]) ]; foreach ($subcommands as $subcommand) { diff --git a/src/thebigcrafter/omp/commands/subcommands/UpdateCommand.php b/src/thebigcrafter/omp/commands/subcommands/UpdateCommand.php new file mode 100644 index 0000000..941a36d --- /dev/null +++ b/src/thebigcrafter/omp/commands/subcommands/UpdateCommand.php @@ -0,0 +1,29 @@ + + * This source file is subject to the GPL-3.0 license that is bundled + * with this source code in the file LICENSE. + */ + +declare(strict_types=1); + +namespace thebigcrafter\omp\commands\subcommands; + +use CortexPE\Commando\BaseSubCommand; +use pocketmine\command\CommandSender; +use thebigcrafter\omp\OhMyPMMP; + +class UpdateCommand extends BaseSubCommand +{ + protected function prepare() : void + { + $this->setPermission("oh-my-pmmp.update"); + } + + public function onRun(CommandSender $sender, string $aliasUsed, array $args) : void + { + OhMyPMMP::getInstance()->cachePlugins(); + } +}