mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Player: avoid unnecessary network updates on repeated calls to setAllowFLight(), setHasBlockCollision() and setAutoJump()
This commit is contained in:
@ -396,8 +396,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
}
|
||||
|
||||
public function setAllowFlight(bool $value) : void{
|
||||
$this->allowFlight = $value;
|
||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||
if($this->allowFlight !== $value){
|
||||
$this->allowFlight = $value;
|
||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllowFlight() : bool{
|
||||
@ -405,8 +407,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
}
|
||||
|
||||
public function setHasBlockCollision(bool $value) : void{
|
||||
$this->blockCollision = $value;
|
||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||
if($this->blockCollision !== $value){
|
||||
$this->blockCollision = $value;
|
||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function hasBlockCollision() : bool{
|
||||
@ -426,8 +430,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
}
|
||||
|
||||
public function setAutoJump(bool $value) : void{
|
||||
$this->autoJump = $value;
|
||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||
if($this->autoJump !== $value){
|
||||
$this->autoJump = $value;
|
||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function hasAutoJump() : bool{
|
||||
|
Reference in New Issue
Block a user