Merge branch 'master' into mcpe-1.0

This commit is contained in:
Dylan K. Taylor
2017-01-27 16:58:53 +00:00
3 changed files with 19 additions and 12 deletions

View File

@ -523,20 +523,18 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
}
public function sendCommandData(){
$pk = new AvailableCommandsPacket();
$data = new \stdClass();
$count = 0;
foreach($this->server->getCommandMap()->getCommands() as $command){
//TODO: fix command permission checks on join
/*if(!$command->testPermissionSilent($this)){
continue;
}*/
++$count;
$data->{$command->getName()}->versions[0] = $command->generateCustomCommandData($this);
if(($cmdData = $command->generateCustomCommandData($this)) !== null){
++$count;
$data->{$command->getName()}->versions[0] = $cmdData;
}
}
if($count > 0){
//TODO: structure checking
$pk = new AvailableCommandsPacket();
$pk->commands = json_encode($data);
$this->dataPacket($pk);
}