diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index f780677b9..567c82c7c 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -512,7 +512,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new ChunkRadiusUpdatedPacket(); $pk->radius = $this->viewDistance; - $this->dataPacket($pk); + $this->sendDataPacket($pk); $this->server->getLogger()->debug("Setting view distance for " . $this->getName() . " to " . $this->viewDistance . " (requested " . $distance . ")"); } @@ -651,7 +651,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->commandData[$command->getName()] = $data; } - $this->dataPacket($pk); + $this->sendDataPacket($pk); } @@ -1138,7 +1138,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->z = $this->spawnPosition->getFloorZ(); $pk->spawnType = SetSpawnPositionPacket::TYPE_PLAYER_SPAWN; $pk->spawnForced = false; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -1199,7 +1199,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new AnimatePacket(); $pk->entityRuntimeId = $this->id; $pk->action = AnimatePacket::ACTION_STOP_SLEEP; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } } @@ -1336,7 +1336,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ public function sendGamemode(){ $pk = new SetPlayerGameTypePacket(); $pk->gamemode = Player::getClientFriendlyGamemode($this->gamemode); - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -1356,7 +1356,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->playerPermission = ($this->isOp() ? PlayerPermissions::OPERATOR : PlayerPermissions::MEMBER); $pk->entityUniqueId = $this->getId(); - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -1613,7 +1613,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new UpdateAttributesPacket(); $pk->entityRuntimeId = $this->id; $pk->entries = $entries; - $this->dataPacket($pk); + $this->sendDataPacket($pk); foreach($entries as $entry){ $entry->markSynchronized(); } @@ -1721,7 +1721,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->particles = $effect->isVisible(); $pk->duration = $effect->getDuration(); - $this->dataPacket($pk); + $this->sendDataPacket($pk); } protected function sendEffectRemove(EffectInstance $effect) : void{ @@ -1730,7 +1730,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->eventId = MobEffectPacket::EVENT_REMOVE; $pk->effectId = $effect->getId(); - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -2018,7 +2018,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ return false; } - $this->dataPacket($packet); + $this->sendDataPacket($packet); $this->server->broadcastPacket($this->getViewers(), $packet); break; default: @@ -2301,7 +2301,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->entityRuntimeId = $target->getId(); $this->server->broadcastPacket($target->getViewers(), $pk); if($target instanceof Player){ - $target->dataPacket($pk); + $target->sendDataPacket($pk); } } @@ -2689,24 +2689,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ return $this->networkSession->sendDataPacket($packet, $immediate); } - /** - * @param DataPacket $packet - * - * @return bool - */ - public function dataPacket(DataPacket $packet) : bool{ - return $this->sendDataPacket($packet, false); - } - - /** - * @param DataPacket $packet - * - * @return bool - */ - public function directDataPacket(DataPacket $packet) : bool{ - return $this->sendDataPacket($packet, true); - } - /** * Transfers a player to another server. * @@ -2723,7 +2705,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new TransferPacket(); $pk->address = $ev->getAddress(); $pk->port = $ev->getPort(); - $this->directDataPacket($pk); + $this->sendDataPacket($pk, true); $this->close("", $ev->getMessage(), false); return true; @@ -2804,7 +2786,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ public function removeTitles(){ $pk = new SetTitlePacket(); $pk->type = SetTitlePacket::TYPE_CLEAR_TITLE; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -2813,7 +2795,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ public function resetTitles(){ $pk = new SetTitlePacket(); $pk->type = SetTitlePacket::TYPE_RESET_TITLE; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -2830,7 +2812,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->fadeInTime = $fadeIn; $pk->stayTime = $stay; $pk->fadeOutTime = $fadeOut; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } } @@ -2844,7 +2826,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new SetTitlePacket(); $pk->type = $type; $pk->text = $title; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -2864,7 +2846,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new TextPacket(); $pk->type = TextPacket::TYPE_RAW; $pk->message = $this->server->getLanguage()->translateString($message); - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -2885,7 +2867,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->type = TextPacket::TYPE_RAW; $pk->message = $this->server->getLanguage()->translateString($message, $parameters); } - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -2900,14 +2882,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk = new TextPacket(); $pk->type = TextPacket::TYPE_POPUP; $pk->message = $message; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } public function sendTip(string $message){ $pk = new TextPacket(); $pk->type = TextPacket::TYPE_TIP; $pk->message = $message; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -2919,7 +2901,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ $pk->type = TextPacket::TYPE_WHISPER; $pk->sourceName = $sender; $pk->message = $message; - $this->dataPacket($pk); + $this->sendDataPacket($pk); } /** @@ -3324,7 +3306,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ if($targets !== null){ $this->server->broadcastPacket($targets, $pk); }else{ - $this->dataPacket($pk); + $this->sendDataPacket($pk); } $this->newPosition = null; diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index b462287c7..87a2a6a5c 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2335,7 +2335,7 @@ class Server{ $pk->entries[] = PlayerListEntry::createAdditionEntry($player->getUniqueId(), $player->getId(), $player->getDisplayName(), "", 0, $player->getSkin(), $player->getXuid()); } - $p->dataPacket($pk); + $p->sendDataPacket($pk); } private function checkTickUpdates(int $currentTick, float $tickTime) : void{ diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 80e699274..e51364e6a 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -1930,7 +1930,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ $pk->attributes = $this->attributeMap->getAll(); $pk->metadata = $this->propertyManager->getAll(); - $player->dataPacket($pk); + $player->sendDataPacket($pk); } /** @@ -1971,7 +1971,7 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ if($send){ $pk = new RemoveEntityPacket(); $pk->entityUniqueId = $this->id; - $player->dataPacket($pk); + $player->sendDataPacket($pk); } unset($this->hasSpawned[$player->getLoaderId()]); } @@ -2092,11 +2092,11 @@ abstract class Entity extends Location implements Metadatable, EntityIds{ if($p === $this){ continue; } - $p->dataPacket(clone $pk); + $p->sendDataPacket(clone $pk); } if($this instanceof Player){ - $this->dataPacket($pk); + $this->sendDataPacket($pk); } } diff --git a/src/pocketmine/entity/Human.php b/src/pocketmine/entity/Human.php index da5a7220b..7aa322ad2 100644 --- a/src/pocketmine/entity/Human.php +++ b/src/pocketmine/entity/Human.php @@ -842,7 +842,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ $pk = new PlayerListPacket(); $pk->type = PlayerListPacket::TYPE_ADD; $pk->entries = [PlayerListEntry::createAdditionEntry($this->uuid, $this->id, $this->getName(), $this->getName(), 0, $this->skin)]; - $player->dataPacket($pk); + $player->sendDataPacket($pk); } $pk = new AddPlayerPacket(); @@ -855,7 +855,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ $pk->pitch = $this->pitch; $pk->item = $this->getInventory()->getItemInHand(); $pk->metadata = $this->propertyManager->getAll(); - $player->dataPacket($pk); + $player->sendDataPacket($pk); //TODO: Hack for MCPE 1.2.13: DATA_NAMETAG is useless in AddPlayerPacket, so it has to be sent separately $this->sendData($player, [self::DATA_NAMETAG => [self::DATA_TYPE_STRING, $this->getNameTag()]]); @@ -866,7 +866,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{ $pk = new PlayerListPacket(); $pk->type = PlayerListPacket::TYPE_REMOVE; $pk->entries = [PlayerListEntry::createRemovalEntry($this->uuid)]; - $player->dataPacket($pk); + $player->sendDataPacket($pk); } } diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index 1c70235af..e78fa834a 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -341,7 +341,7 @@ abstract class Living extends Entity implements Damageable{ $pk->duration = $effect->getDuration(); $pk->eventId = MobEffectPacket::EVENT_ADD; - $player->dataPacket($pk); + $player->sendDataPacket($pk); } } diff --git a/src/pocketmine/entity/object/ItemEntity.php b/src/pocketmine/entity/object/ItemEntity.php index 2e38a386a..708087e7e 100644 --- a/src/pocketmine/entity/object/ItemEntity.php +++ b/src/pocketmine/entity/object/ItemEntity.php @@ -193,7 +193,7 @@ class ItemEntity extends Entity{ $pk->item = $this->getItem(); $pk->metadata = $this->propertyManager->getAll(); - $player->dataPacket($pk); + $player->sendDataPacket($pk); } public function onCollideWithPlayer(Player $player) : void{ diff --git a/src/pocketmine/entity/object/Painting.php b/src/pocketmine/entity/object/Painting.php index 6279f0dd7..4dfa7ddcd 100644 --- a/src/pocketmine/entity/object/Painting.php +++ b/src/pocketmine/entity/object/Painting.php @@ -155,7 +155,7 @@ class Painting extends Entity{ $pk->direction = $this->direction; $pk->title = $this->motive; - $player->dataPacket($pk); + $player->sendDataPacket($pk); } /** diff --git a/src/pocketmine/inventory/ArmorInventory.php b/src/pocketmine/inventory/ArmorInventory.php index e894de67d..5d19a8a7c 100644 --- a/src/pocketmine/inventory/ArmorInventory.php +++ b/src/pocketmine/inventory/ArmorInventory.php @@ -108,7 +108,7 @@ class ArmorInventory extends BaseInventory{ $pk2->windowId = $player->getWindowId($this); $pk2->inventorySlot = $index; $pk2->item = $this->getItem($index); - $player->dataPacket($pk2); + $player->sendDataPacket($pk2); }else{ $player->dataPacket($pk); } diff --git a/src/pocketmine/inventory/BaseInventory.php b/src/pocketmine/inventory/BaseInventory.php index 337b3b80a..6a7650dc4 100644 --- a/src/pocketmine/inventory/BaseInventory.php +++ b/src/pocketmine/inventory/BaseInventory.php @@ -443,7 +443,7 @@ abstract class BaseInventory implements Inventory{ continue; } $pk->windowId = $id; - $player->dataPacket($pk); + $player->sendDataPacket($pk); } } @@ -466,7 +466,7 @@ abstract class BaseInventory implements Inventory{ continue; } $pk->windowId = $id; - $player->dataPacket($pk); + $player->sendDataPacket($pk); } } diff --git a/src/pocketmine/inventory/ContainerInventory.php b/src/pocketmine/inventory/ContainerInventory.php index 1a2c4c4ea..4ede6d826 100644 --- a/src/pocketmine/inventory/ContainerInventory.php +++ b/src/pocketmine/inventory/ContainerInventory.php @@ -56,7 +56,7 @@ abstract class ContainerInventory extends BaseInventory{ $pk->z = $holder->getFloorZ(); } - $who->dataPacket($pk); + $who->sendDataPacket($pk); $this->sendContents($who); } @@ -64,7 +64,7 @@ abstract class ContainerInventory extends BaseInventory{ public function onClose(Player $who) : void{ $pk = new ContainerClosePacket(); $pk->windowId = $who->getWindowId($this); - $who->dataPacket($pk); + $who->sendDataPacket($pk); parent::onClose($who); } diff --git a/src/pocketmine/inventory/PlayerInventory.php b/src/pocketmine/inventory/PlayerInventory.php index b701afca0..6d43f5286 100644 --- a/src/pocketmine/inventory/PlayerInventory.php +++ b/src/pocketmine/inventory/PlayerInventory.php @@ -144,7 +144,7 @@ class PlayerInventory extends BaseInventory{ $pk->windowId = ContainerIds::INVENTORY; if(!is_array($target)){ - $target->dataPacket($pk); + $target->sendDataPacket($pk); if($target === $this->getHolder()){ $this->sendSlot($this->getHeldItemIndex(), $target); } @@ -174,7 +174,7 @@ class PlayerInventory extends BaseInventory{ } } - $this->getHolder()->dataPacket($pk); + $this->getHolder()->sendDataPacket($pk); } /** diff --git a/src/pocketmine/inventory/transaction/CraftingTransaction.php b/src/pocketmine/inventory/transaction/CraftingTransaction.php index 6de3a4b52..d69b0d5ac 100644 --- a/src/pocketmine/inventory/transaction/CraftingTransaction.php +++ b/src/pocketmine/inventory/transaction/CraftingTransaction.php @@ -149,7 +149,7 @@ class CraftingTransaction extends InventoryTransaction{ */ $pk = new ContainerClosePacket(); $pk->windowId = ContainerIds::NONE; - $this->source->dataPacket($pk); + $this->source->sendDataPacket($pk); } public function execute() : bool{ diff --git a/src/pocketmine/tile/Furnace.php b/src/pocketmine/tile/Furnace.php index 2790f52d2..848d5fba2 100644 --- a/src/pocketmine/tile/Furnace.php +++ b/src/pocketmine/tile/Furnace.php @@ -235,7 +235,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{ if($windowId > 0){ foreach($packets as $pk){ $pk->windowId = $windowId; - $player->dataPacket(clone $pk); + $player->sendDataPacket(clone $pk); } } } diff --git a/src/pocketmine/tile/Spawnable.php b/src/pocketmine/tile/Spawnable.php index 76c3f3c64..98e385a53 100644 --- a/src/pocketmine/tile/Spawnable.php +++ b/src/pocketmine/tile/Spawnable.php @@ -52,7 +52,7 @@ abstract class Spawnable extends Tile{ return false; } - $player->dataPacket($this->createSpawnPacket()); + $player->sendDataPacket($this->createSpawnPacket()); return true; }