Entity: clean up sendData() handling, remove send-to-self hack

This commit is contained in:
Dylan K. Taylor
2020-10-08 21:35:36 +01:00
parent 01b44ab0bc
commit b0b08d45d5
6 changed files with 21 additions and 24 deletions

View File

@@ -649,8 +649,7 @@ class NetworkSession{
}
public function onRespawn() : void{
$this->player->sendData($this->player);
$this->player->sendData($this->player->getViewers());
$this->player->sendData(null);
$this->syncAdventureSettings($this->player);
$this->invManager->syncAll();

View File

@@ -506,22 +506,22 @@ class InGamePacketHandler extends PacketHandler{
return true;
case PlayerActionPacket::ACTION_START_SPRINT:
if(!$this->player->toggleSprint(true)){
$this->player->sendData($this->player);
$this->player->sendData([$this->player]);
}
return true;
case PlayerActionPacket::ACTION_STOP_SPRINT:
if(!$this->player->toggleSprint(false)){
$this->player->sendData($this->player);
$this->player->sendData([$this->player]);
}
return true;
case PlayerActionPacket::ACTION_START_SNEAK:
if(!$this->player->toggleSneak(true)){
$this->player->sendData($this->player);
$this->player->sendData([$this->player]);
}
return true;
case PlayerActionPacket::ACTION_STOP_SNEAK:
if(!$this->player->toggleSneak(false)){
$this->player->sendData($this->player);
$this->player->sendData([$this->player]);
}
return true;
case PlayerActionPacket::ACTION_START_GLIDE:

View File

@@ -95,7 +95,7 @@ class PreSpawnPacketHandler extends PacketHandler{
foreach($this->player->getEffects()->all() as $effect){
$this->session->onEntityEffectAdded($this->player, $effect, false);
}
$this->player->sendData($this->player);
$this->player->sendData([$this->player]);
$this->session->getInvManager()->syncAll();
$this->session->getInvManager()->syncCreative();