Fix some command stupidity

This is why NOT to write code at 11PM when one is shattered.
This commit is contained in:
Dylan K. Taylor 2017-01-27 11:21:21 +00:00
parent 69d6d24a38
commit 9661d845bb
2 changed files with 6 additions and 8 deletions

View File

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

View File

@ -108,7 +108,7 @@ abstract class Command{
*/ */
public function generateCustomCommandData(Player $player){ public function generateCustomCommandData(Player $player){
//TODO: fix command permission filtering on join //TODO: fix command permission filtering on join
/*if(!$this->testPermission($player)){ /*if(!$this->testPermissionSilent($player)){
return null; return null;
}*/ }*/
$customData = clone $this->commandData; $customData = clone $this->commandData;