diff --git a/src/command/SimpleCommandMap.php b/src/command/SimpleCommandMap.php index 5c33bf25a..bab101d5d 100644 --- a/src/command/SimpleCommandMap.php +++ b/src/command/SimpleCommandMap.php @@ -139,7 +139,7 @@ class SimpleCommandMap implements CommandMap{ public function register(string $fallbackPrefix, Command $command, ?string $label = null) : bool{ if($label === null){ - $label = $command->getName(); + $label = $command->getLabel(); } $label = trim($label); $fallbackPrefix = strtolower(trim($fallbackPrefix)); diff --git a/src/command/defaults/HelpCommand.php b/src/command/defaults/HelpCommand.php index 7fe12e039..3dc581838 100644 --- a/src/command/defaults/HelpCommand.php +++ b/src/command/defaults/HelpCommand.php @@ -80,7 +80,7 @@ class HelpCommand extends VanillaCommand{ $commands = []; foreach($sender->getServer()->getCommandMap()->getCommands() as $command){ if($command->testPermissionSilent($sender)){ - $commands[$command->getName()] = $command; + $commands[$command->getLabel()] = $command; } } ksort($commands, SORT_NATURAL | SORT_FLAG_CASE); @@ -95,7 +95,7 @@ class HelpCommand extends VanillaCommand{ foreach($commands[$pageNumber - 1] as $command){ $description = $command->getDescription(); $descriptionString = $description instanceof Translatable ? $lang->translate($description) : $description; - $sender->sendMessage(TextFormat::DARK_GREEN . "/" . $command->getName() . ": " . TextFormat::WHITE . $descriptionString); + $sender->sendMessage(TextFormat::DARK_GREEN . "/" . $command->getLabel() . ": " . TextFormat::WHITE . $descriptionString); } } @@ -106,7 +106,7 @@ class HelpCommand extends VanillaCommand{ $lang = $sender->getLanguage(); $description = $cmd->getDescription(); $descriptionString = $description instanceof Translatable ? $lang->translate($description) : $description; - $sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_header($cmd->getName()) + $sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_header($cmd->getLabel()) ->format(TextFormat::YELLOW . "--------- " . TextFormat::WHITE, TextFormat::YELLOW . " ---------")); $sender->sendMessage(KnownTranslationFactory::pocketmine_command_help_specificCommand_description(TextFormat::WHITE . $descriptionString) ->prefix(TextFormat::GOLD)); diff --git a/src/network/mcpe/NetworkSession.php b/src/network/mcpe/NetworkSession.php index ffd80e49d..5b090cc35 100644 --- a/src/network/mcpe/NetworkSession.php +++ b/src/network/mcpe/NetworkSession.php @@ -888,11 +888,11 @@ class NetworkSession{ public function syncAvailableCommands() : void{ $commandData = []; foreach($this->server->getCommandMap()->getCommands() as $name => $command){ - if(isset($commandData[$command->getName()]) || $command->getName() === "help" || !$command->testPermissionSilent($this->player)){ + if(isset($commandData[$command->getLabel()]) || $command->getLabel() === "help" || !$command->testPermissionSilent($this->player)){ continue; } - $lname = strtolower($command->getName()); + $lname = strtolower($command->getLabel()); $aliases = $command->getAliases(); $aliasObj = null; if(count($aliases) > 0){ @@ -900,7 +900,7 @@ class NetworkSession{ //work around a client bug which makes the original name not show when aliases are used $aliases[] = $lname; } - $aliasObj = new CommandEnum(ucfirst($command->getName()) . "Aliases", array_values($aliases)); + $aliasObj = new CommandEnum(ucfirst($command->getLabel()) . "Aliases", array_values($aliases)); } $description = $command->getDescription(); @@ -915,7 +915,7 @@ class NetworkSession{ ] ); - $commandData[$command->getName()] = $data; + $commandData[$command->getLabel()] = $data; } $this->sendDataPacket(AvailableCommandsPacket::create($commandData, [], [], []));