mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 08:44:01 +00:00
Resend command data when op status changes
This commit is contained in:
parent
018897062c
commit
192fba9c88
@ -440,6 +440,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
|
||||
$this->recalculatePermissions();
|
||||
$this->sendCommandData();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -503,6 +504,19 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
return $this->perm->getEffectivePermissions();
|
||||
}
|
||||
|
||||
public function sendCommandData(){
|
||||
$pk = new AvailableCommandsPacket();
|
||||
$data = [];
|
||||
foreach($this->server->getCommandMap()->getCommands() as $command){
|
||||
$data[$command->getName()] = $command->generateJsonData($this);
|
||||
}
|
||||
if(count($data) > 0){
|
||||
//TODO: structure checking
|
||||
$pk->commands = json_encode($data);
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SourceInterface $interface
|
||||
* @param null $clientID
|
||||
@ -1713,14 +1727,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
if($this->isOp()){
|
||||
$this->setRemoveFormat(false);
|
||||
}
|
||||
|
||||
$pk = new AvailableCommandsPacket();
|
||||
$data = [];
|
||||
foreach($this->server->getCommandMap()->getCommands() as $command){
|
||||
$data[$command->getName()] = $command->generateJsonData($this);
|
||||
}
|
||||
$pk->commands = json_encode($data);
|
||||
$this->dataPacket($pk);
|
||||
|
||||
$this->sendCommandData();
|
||||
|
||||
if($this->isCreative()){
|
||||
$this->inventory->sendCreativeContents();
|
||||
|
Loading…
x
Reference in New Issue
Block a user