Player: avoid unnecessary network updates on repeated calls to setAllowFLight(), setHasBlockCollision() and setAutoJump()

This commit is contained in:
Dylan K. Taylor 2021-12-29 20:22:16 +00:00
parent e0a6bc1d4a
commit 207f7ec309
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -396,18 +396,22 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
}
public function setAllowFlight(bool $value) : void{
if($this->allowFlight !== $value){
$this->allowFlight = $value;
$this->getNetworkSession()->syncAdventureSettings($this);
}
}
public function getAllowFlight() : bool{
return $this->allowFlight;
}
public function setHasBlockCollision(bool $value) : void{
if($this->blockCollision !== $value){
$this->blockCollision = $value;
$this->getNetworkSession()->syncAdventureSettings($this);
}
}
public function hasBlockCollision() : bool{
return $this->blockCollision;
@ -426,9 +430,11 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
}
public function setAutoJump(bool $value) : void{
if($this->autoJump !== $value){
$this->autoJump = $value;
$this->getNetworkSession()->syncAdventureSettings($this);
}
}
public function hasAutoJump() : bool{
return $this->autoJump;