Player: if command has aliases, add command name as alias if not found

closes #2106

For some strange reason, using aliases overwrites the original command name instead of coexisting with it. This is rather astonishing behaviour, and probably a bug in the client. However, this workaround is the same thing vanilla does (see /tp in vanilla).
This commit is contained in:
Dylan K. Taylor 2018-03-16 10:41:00 +00:00
parent dd844f7ad3
commit fdad965db8

View File

@ -668,6 +668,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$aliases = $command->getAliases();
if(!empty($aliases)){
if(!\in_array($data->commandName, $aliases, true)){
//work around a client bug which makes the original name not show when aliases are used
$aliases[] = $data->commandName;
}
$data->aliases = new CommandEnum();
$data->aliases->enumName = ucfirst($command->getName()) . "Aliases";
$data->aliases->enumValues = $aliases;