mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +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{
|
public function setAllowFlight(bool $value) : void{
|
||||||
$this->allowFlight = $value;
|
if($this->allowFlight !== $value){
|
||||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
$this->allowFlight = $value;
|
||||||
|
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAllowFlight() : bool{
|
public function getAllowFlight() : bool{
|
||||||
@ -405,8 +407,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setHasBlockCollision(bool $value) : void{
|
public function setHasBlockCollision(bool $value) : void{
|
||||||
$this->blockCollision = $value;
|
if($this->blockCollision !== $value){
|
||||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
$this->blockCollision = $value;
|
||||||
|
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasBlockCollision() : bool{
|
public function hasBlockCollision() : bool{
|
||||||
@ -426,8 +430,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setAutoJump(bool $value) : void{
|
public function setAutoJump(bool $value) : void{
|
||||||
$this->autoJump = $value;
|
if($this->autoJump !== $value){
|
||||||
$this->getNetworkSession()->syncAdventureSettings($this);
|
$this->autoJump = $value;
|
||||||
|
$this->getNetworkSession()->syncAdventureSettings($this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasAutoJump() : bool{
|
public function hasAutoJump() : bool{
|
||||||
|
Reference in New Issue
Block a user