Player: Reintroduce permission checks for command hints

This was removed way back in 2016 because of an unidentified bug which caused permissible commands not to show up on the client. Back then, command parsing and validity checks were client-sided, and the client would simply not send the command at all if it didn't recognize it. Now, that problem is gone, so it doesn't matter as much if there are permission bugs which cause commands to be erroneously missing.
closes #2625
This commit is contained in:
Dylan K. Taylor 2018-12-31 19:35:54 +00:00
parent 1393b4c4e2
commit 1cbb31f1db

View File

@ -676,7 +676,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
public function sendCommandData(){
$pk = new AvailableCommandsPacket();
foreach($this->server->getCommandMap()->getCommands() as $name => $command){
if(isset($pk->commandData[$command->getName()]) or $command->getName() === "help"){
if(isset($pk->commandData[$command->getName()]) or $command->getName() === "help" or !$command->testPermissionSilent($this)){
continue;
}