diff --git a/src/CortexPE/Commando/traits/ArgumentableTrait.php b/src/CortexPE/Commando/traits/ArgumentableTrait.php index ed04419..42fd22d 100644 --- a/src/CortexPE/Commando/traits/ArgumentableTrait.php +++ b/src/CortexPE/Commando/traits/ArgumentableTrait.php @@ -96,6 +96,7 @@ public function parseArguments(array $rawArgs, CommandSender $sender): array { ]; } $offset = 0; + $argOffset = 0; if(count($rawArgs) > 0) { foreach($this->argumentList as $pos => $possibleArguments) { // try the one that spans more first... before the others @@ -128,6 +129,7 @@ public function parseArguments(array $rawArgs, CommandSender $sender): array { $required--; } $offset += $len; + ++$argOffset; $parsed = true; break; } @@ -136,7 +138,7 @@ public function parseArguments(array $rawArgs, CommandSender $sender): array { } } if(!$parsed && !($optional && empty($arg))) { // we tried every other possible argument type, none was satisfied - $expectedArgs = $this->argumentList[$offset]; + $expectedArgs = $this->argumentList[$argOffset]; $expected = ""; foreach($expectedArgs as $expectedArg){ $expected .= $expectedArg->getTypeName() . "|";