Skip to content

NetworkSession ​

class · pocketmine\network\mcpe\NetworkSession · source

Methods ​

__construct() ​

php
public function __construct(\pocketmine\Server $server, \pocketmine\network\NetworkSessionManager $manager, \pocketmine\network\mcpe\protocol\PacketPool $packetPool, \pocketmine\network\mcpe\PacketSender $sender, \pocketmine\network\mcpe\PacketBroadcaster $broadcaster, \pocketmine\network\mcpe\EntityEventBroadcaster $entityEventBroadcaster, \pocketmine\network\mcpe\compression\Compressor $compress …

createPlayer() protected ​

php
protected function createPlayer() : void

disconnect() ​

php
public function disconnect(\pocketmine\lang\Translatable|string $reason, \pocketmine\lang\Translatable|string|null $disconnectScreenMessage = null, bool $notify = true) : void

Disconnects the session, destroying the associated player (if it exists).

disconnectIncompatibleProtocol() ​

php
public function disconnectIncompatibleProtocol(int $protocolVersion) : void

disconnectWithError() ​

php
public function disconnectWithError(\pocketmine\lang\Translatable|string $reason, \pocketmine\lang\Translatable|string|null $disconnectScreenMessage = null) : void

getBroadcaster() ​

php
public function getBroadcaster() : \pocketmine\network\mcpe\PacketBroadcaster

getClearTerrainOnWorldChange() 5.46.0 ​

php
public function getClearTerrainOnWorldChange() : bool

Whether a switch between two worlds of the same dimension makes the client drop the previous world's terrain, by sending it through another dimension and back (with the dimension loading screen). Defaults to player.clear-terrain-on-world-change in pocketmine.yml. Without it, chunks of the previous world the new world doesn't overwrite stay visible on the client.

getClientDimension() 5.46.0 ​

php
public function getClientDimension() : ?\pocketmine\world\dimension\Dimension

Returns the dimension the client currently renders, or null before StartGamePacket was sent.

getCompressor() ​

php
public function getCompressor() : \pocketmine\network\mcpe\compression\Compressor

getDisplayName() ​

php
public function getDisplayName() : string

getEntityEventBroadcaster() ​

php
public function getEntityEventBroadcaster() : \pocketmine\network\mcpe\EntityEventBroadcaster

getHandler() ​

php
public function getHandler() : ?\pocketmine\network\mcpe\handler\PacketHandler

getInvManager() ​

php
public function getInvManager() : ?\pocketmine\network\mcpe\InventoryManager

getIp() ​

php
public function getIp() : string

getLogger() ​

php
public function getLogger() : \Logger

getPing() ​

php
public function getPing() : ?int

getPlayer() ​

php
public function getPlayer() : ?\pocketmine\player\Player

getPlayerInfo() ​

php
public function getPlayerInfo() : ?\pocketmine\player\PlayerInfo

getPort() ​

php
public function getPort() : int

getTransportName() 5.46.0 ​

php
public function getTransportName() : string

Returns the name of the transport carrying this session ("raknet", "nethernet"...), or "unknown" if the packet sender does not say.

getTypeConverter() ​

php
public function getTypeConverter() : \pocketmine\network\mcpe\convert\TypeConverter

handleAckReceipt() ​

php
public function handleAckReceipt(int $receiptId) : void

handleDataPacket() ​

php
public function handleDataPacket(\pocketmine\network\mcpe\protocol\Packet $packet, string $buffer) : void

handleEncoded() ​

php
public function handleEncoded(string $payload) : void

isChangingDimension() 5.46.0 ​

php
public function isChangingDimension() : bool

Whether the client is in the loading screen of a dimension change.

isConnected() ​

php
public function isConnected() : bool

isTransportEncrypted() 5.46.0 ​

php
public function isTransportEncrypted() : bool

Whether the transport already encrypts the traffic, in which case the Minecraft-level encryption handshake is skipped (NetherNet uses DTLS and vanilla clients do not perform the handshake on it).

notifyTerrainReady() ​

php
public function notifyTerrainReady() : void

onActionBar() ​

php
public function onActionBar(string $actionBar) : void

onChargeItemComplete() 5.46.0 ​

php
public function onChargeItemComplete() : void

onChatMessage() ​

php
public function onChatMessage(\pocketmine\lang\Translatable|string $message) : void

onClearTitle() ​

php
public function onClearTitle() : void

onClientDisconnect() ​

php
public function onClientDisconnect(\pocketmine\lang\Translatable|string $reason) : void

Called by the network interface to close the session when the client disconnects without server input, for example in a timeout condition or voluntary client disconnect.

onCloseAllForms() ​

php
public function onCloseAllForms() : void

onEnterWorld() ​

php
public function onEnterWorld() : void

onFormSent() ​

php
public function onFormSent(int $id, \pocketmine\form\Form $form) : bool

onGlideBoost() 5.46.0 ​

php
public function onGlideBoost(int $durationTicks) : void

Tells the client about a firework boost while gliding, so it can predict its own movement for the given duration.

onItemCooldownChanged() ​

php
public function onItemCooldownChanged(\pocketmine\item\Item $item, int $ticks) : void

onJukeboxPopup() ​

php
public function onJukeboxPopup(\pocketmine\lang\Translatable|string $message) : void

onOpenSignEditor() ​

php
public function onOpenSignEditor(\pocketmine\math\Vector3 $signPosition, bool $frontSide) : void

onPlayerAdded() ​

php
public function onPlayerAdded(\pocketmine\player\Player $p) : void

onPlayerDestroyed() ​

php
public function onPlayerDestroyed(\pocketmine\lang\Translatable|string $reason, \pocketmine\lang\Translatable|string $disconnectScreenMessage) : void

Called by the Player when it is closed (for example due to getting kicked).

onPlayerRemoved() ​

php
public function onPlayerRemoved(\pocketmine\player\Player $p) : void

onPopup() ​

php
public function onPopup(string $message) : void

onResetTitleOptions() ​

php
public function onResetTitleOptions() : void

onServerDeath() ​

php
public function onServerDeath(\pocketmine\lang\Translatable|string $deathMessage) : void

onServerRespawn() ​

php
public function onServerRespawn() : void

onSubTitle() ​

php
public function onSubTitle(string $subtitle) : void

onTip() ​

php
public function onTip(string $message) : void

onTitle() ​

php
public function onTitle(string $title) : void

onTitleDuration() ​

php
public function onTitleDuration(int $fadeIn, int $stay, int $fadeOut) : void

onToastNotification() ​

php
public function onToastNotification(string $title, string $body) : void

prepareClientTranslatableMessage() ​

php
public function prepareClientTranslatableMessage(\pocketmine\lang\Translatable $message) : array

queueCompressed() ​

php
public function queueCompressed(\pocketmine\network\mcpe\compression\CompressBatchPromise|string $payload, bool $immediate = false) : void

sendDataPacket() ​

php
public function sendDataPacket(\pocketmine\network\mcpe\protocol\ClientboundPacket $packet, bool $immediate = false) : bool

sendDataPacketWithReceipt() ​

php
public function sendDataPacketWithReceipt(\pocketmine\network\mcpe\protocol\ClientboundPacket $packet, bool $immediate = false) : \pocketmine\promise\Promise

setClearTerrainOnWorldChange() 5.46.0 ​

php
public function setClearTerrainOnWorldChange(bool $clear) : void

setHandler() ​

php
public function setHandler(?\pocketmine\network\mcpe\handler\PacketHandler $handler) : void

setLastPlayerInputTick() 5.46.0 ​

php
public function setLastPlayerInputTick(int $tick) : void

startUsingChunk() ​

php
public function startUsingChunk(int $chunkX, int $chunkZ, \Closure $onCompletion) : void

Instructs the networksession to start using the chunk at the given coordinates. This may occur asynchronously.

stopUsingChunk() ​

php
public function stopUsingChunk(int $chunkX, int $chunkZ) : void

syncAbilities() ​

php
public function syncAbilities(\pocketmine\player\Player $for) : void

syncAdventureSettings() ​

php
public function syncAdventureSettings() : void

syncAvailableCommands() ​

php
public function syncAvailableCommands() : void

syncGameMode() ​

php
public function syncGameMode(\pocketmine\player\GameMode $mode, bool $isRollback = false) : void

syncMovement() ​

php
public function syncMovement(\pocketmine\math\Vector3 $pos, ?float $yaw = null, ?float $pitch = null, int $mode = \pocketmine\network\mcpe\protocol\MovePlayerPacket::MODE_NORMAL) : void

syncPlayerList() ​

php
public function syncPlayerList(array $players) : void

syncPlayerSpawnPoint() ​

php
public function syncPlayerSpawnPoint(\pocketmine\world\Position $newSpawn) : void

syncViewAreaCenterPoint() ​

php
public function syncViewAreaCenterPoint(\pocketmine\math\Vector3 $newPos, int $viewDistance) : void

syncViewAreaRadius() ​

php
public function syncViewAreaRadius(int $distance) : void

syncWorldDifficulty() ​

php
public function syncWorldDifficulty(int $worldDifficulty) : void

syncWorldSpawnPoint() ​

php
public function syncWorldSpawnPoint(\pocketmine\world\Position $newSpawn) : void

syncWorldTime() ​

php
public function syncWorldTime(int $worldTime) : void

syncWorldWeather() 5.46.0 ​

php
public function syncWorldWeather(float $rainLevel, float $lightningLevel) : void

Sends the rain and thunder state: START_RAIN/START_THUNDER carry the intensity (0-65535), 0 stops them.

tick() ​

php
public function tick() : void

transfer() ​

php
public function transfer(string $ip, int $port, \pocketmine\lang\Translatable|string|null $reason = null) : void

Instructs the remote client to connect to a different server.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.