Skip to content

Commit

Permalink
Add update command
Browse files Browse the repository at this point in the history
  • Loading branch information
toby7002 committed Oct 20, 2023
1 parent ea5d284 commit 6d461f5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
4 changes: 3 additions & 1 deletion resources/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
4 changes: 3 additions & 1 deletion src/thebigcrafter/omp/commands/OMPCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down
29 changes: 29 additions & 0 deletions src/thebigcrafter/omp/commands/subcommands/UpdateCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/*
* This file is part of oh-my-pmmp.
* (c) thebigcrafter <[email protected]>
* 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();
}
}

0 comments on commit 6d461f5

Please sign in to comment.