SimpleCommandMap: ensure we always pass a list to Command::setAliases()

some offsets may have been removed if the alias failed to be registered.
This commit is contained in:
Dylan K. Taylor 2025-01-06 22:43:34 +00:00
parent 59f6c85105
commit e30ae487dc
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -73,6 +73,7 @@ use pocketmine\timings\Timings;
use pocketmine\utils\TextFormat;
use pocketmine\utils\Utils;
use function array_shift;
use function array_values;
use function count;
use function implode;
use function str_contains;
@ -163,7 +164,7 @@ class SimpleCommandMap implements CommandMap{
unset($aliases[$index]);
}
}
$command->setAliases($aliases);
$command->setAliases(array_values($aliases));
if(!$registered){
$command->setLabel($fallbackPrefix . ":" . $label);