Skip to content

Commit

Permalink
Update for new protocol changes (CortexPE#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonw4331 authored Jul 16, 2023
1 parent d34b2fc commit 6a83974
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions src/CortexPE/Commando/PacketHooker.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
use pocketmine\network\mcpe\NetworkSession;
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
use pocketmine\network\mcpe\protocol\types\command\CommandEnum;
use pocketmine\network\mcpe\protocol\types\command\CommandOverload;
use pocketmine\network\mcpe\protocol\types\command\CommandParameter;
use pocketmine\plugin\Plugin;
use pocketmine\Server;
use function array_unshift;
use function count;

class PacketHooker implements Listener {
Expand Down Expand Up @@ -88,7 +88,7 @@ public static function register(Plugin $registrant): void {
* @param CommandSender $cs
* @param BaseCommand $command
*
* @return CommandParameter[][]
* @return CommandOverload[]
*/
public static function generateOverloads(CommandSender $cs, BaseCommand $command): array {
$overloads = [];
Expand All @@ -111,11 +111,10 @@ public static function generateOverloads(CommandSender $cs, BaseCommand $command
$overloadList = self::generateOverloads($cs, $subCommand);
if(!empty($overloadList)){
foreach($overloadList as $overload) {
array_unshift($overload, $scParam);
$overloads[] = $overload;
$overloads[] = new CommandOverload(false, [$scParam, ...$overload->getParameters()]);
}
} else {
$overloads[] = [$scParam];
$overloads[] = new CommandOverload(false, [$scParam]);
}
}

Expand All @@ -129,7 +128,7 @@ public static function generateOverloads(CommandSender $cs, BaseCommand $command
/**
* @param IArgumentable $argumentable
*
* @return CommandParameter[][]
* @return CommandOverload[]
*/
private static function generateOverloadList(IArgumentable $argumentable): array {
$input = $argumentable->getArgumentList();
Expand All @@ -145,7 +144,7 @@ private static function generateOverloadList(IArgumentable $argumentable): array
foreach($indexes as $k => $index){
$set[$k] = clone $input[$k][$index]->getNetworkParameterData();
}
$combinations[] = $set;
$combinations[] = new CommandOverload(false, $set);

foreach($indexes as $k => $v){
$indexes[$k]++;
Expand Down
4 changes: 2 additions & 2 deletions virion.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Commando
antigen: CortexPE\Commando
api: 5.0.0
version: 3.0.0
api: 5.3.0
version: 3.1.0
author: CortexPE
authors: [ParoxityTeam]

0 comments on commit 6a83974

Please sign in to comment.