PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
Loading...
Searching...
No Matches
pocketmine\network\mcpe\NetworkSession Class Reference
+ Collaboration diagram for pocketmine\network\mcpe\NetworkSession:

Public Member Functions

 __construct (private Server $server, private NetworkSessionManager $manager, private PacketPool $packetPool, private PacketSender $sender, private PacketBroadcaster $broadcaster, private EntityEventBroadcaster $entityEventBroadcaster, private Compressor $compressor, private TypeConverter $typeConverter, private string $ip, private int $port)
 
 addToSendBuffer (string $buffer)
 
 disconnect (Translatable|string $reason, Translatable|string|null $disconnectScreenMessage=null, bool $notify=true)
 
 disconnectIncompatibleProtocol (int $protocolVersion)
 
 disconnectWithError (Translatable|string $reason, Translatable|string|null $disconnectScreenMessage=null)
 
 getBroadcaster ()
 
 getCompressor ()
 
 getDisplayName ()
 
 getEntityEventBroadcaster ()
 
 getHandler ()
 
 getInvManager ()
 
 getIp ()
 
 getLogger ()
 
 getPing ()
 
 getPlayer ()
 
 getPlayerInfo ()
 
 getPort ()
 
 getTypeConverter ()
 
 handleAckReceipt (int $receiptId)
 
 handleDataPacket (Packet $packet, string $buffer)
 
 handleEncoded (string $payload)
 
 isConnected ()
 
 notifyTerrainReady ()
 
 onActionBar (string $actionBar)
 
 onChatMessage (Translatable|string $message)
 
 onClearTitle ()
 
 onClientDisconnect (Translatable|string $reason)
 
 onCloseAllForms ()
 
 onEnterWorld ()
 
 onFormSent (int $id, Form $form)
 
 onItemCooldownChanged (Item $item, int $ticks)
 
 onJukeboxPopup (Translatable|string $message)
 
 onOpenSignEditor (Vector3 $signPosition, bool $frontSide)
 
 onPlayerAdded (Player $p)
 
 onPlayerDestroyed (Translatable|string $reason, Translatable|string $disconnectScreenMessage)
 
 onPlayerRemoved (Player $p)
 
 onPopup (string $message)
 
 onResetTitleOptions ()
 
 onServerDeath (Translatable|string $deathMessage)
 
 onServerRespawn ()
 
 onSubTitle (string $subtitle)
 
 onTip (string $message)
 
 onTitle (string $title)
 
 onTitleDuration (int $fadeIn, int $stay, int $fadeOut)
 
 onToastNotification (string $title, string $body)
 
 prepareClientTranslatableMessage (Translatable $message)
 
 queueCompressed (CompressBatchPromise|string $payload, bool $immediate=false)
 
 sendDataPacket (ClientboundPacket $packet, bool $immediate=false)
 
 sendDataPacketWithReceipt (ClientboundPacket $packet, bool $immediate=false)
 
 setHandler (?PacketHandler $handler)
 
 startUsingChunk (int $chunkX, int $chunkZ, \Closure $onCompletion)
 
 stopUsingChunk (int $chunkX, int $chunkZ)
 
 syncAbilities (Player $for)
 
 syncAdventureSettings ()
 
 syncAvailableCommands ()
 
 syncGameMode (GameMode $mode, bool $isRollback=false)
 
 syncMovement (Vector3 $pos, ?float $yaw=null, ?float $pitch=null, int $mode=MovePlayerPacket::MODE_NORMAL)
 
 syncPlayerList (array $players)
 
 syncPlayerSpawnPoint (Position $newSpawn)
 
 syncViewAreaCenterPoint (Vector3 $newPos, int $viewDistance)
 
 syncViewAreaRadius (int $distance)
 
 syncWorldDifficulty (int $worldDifficulty)
 
 syncWorldSpawnPoint (Position $newSpawn)
 
 syncWorldTime (int $worldTime)
 
 tick ()
 
 transfer (string $ip, int $port, Translatable|string|null $reason=null)
 
 updatePing (int $ping)
 

Static Public Member Functions

static encodePacketTimed (PacketSerializer $serializer, ClientboundPacket $packet)
 

Protected Member Functions

 createPlayer ()
 

Detailed Description

Definition at line 140 of file NetworkSession.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\network\mcpe\NetworkSession::__construct ( private Server $server,
private NetworkSessionManager $manager,
private PacketPool $packetPool,
private PacketSender $sender,
private PacketBroadcaster $broadcaster,
private EntityEventBroadcaster $entityEventBroadcaster,
private Compressor $compressor,
private TypeConverter $typeConverter,
private string $ip,
private int $port )

Definition at line 194 of file NetworkSession.php.

Member Function Documentation

◆ addToSendBuffer()

pocketmine\network\mcpe\NetworkSession::addToSendBuffer ( string $buffer)

Definition at line 572 of file NetworkSession.php.

◆ createPlayer()

pocketmine\network\mcpe\NetworkSession::createPlayer ( )
protected

Definition at line 250 of file NetworkSession.php.

◆ disconnect()

pocketmine\network\mcpe\NetworkSession::disconnect ( Translatable|string $reason,
Translatable|string|null $disconnectScreenMessage = null,
bool $notify = true )

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

Parameters
Translatable | string$reasonShown in the server log - this should be a short one-line message
Translatable | string | null$disconnectScreenMessageShown on the player's disconnection screen (null will use the reason)

Definition at line 758 of file NetworkSession.php.

◆ disconnectIncompatibleProtocol()

pocketmine\network\mcpe\NetworkSession::disconnectIncompatibleProtocol ( int $protocolVersion)

Definition at line 778 of file NetworkSession.php.

◆ disconnectWithError()

pocketmine\network\mcpe\NetworkSession::disconnectWithError ( Translatable|string $reason,
Translatable|string|null $disconnectScreenMessage = null )

Definition at line 769 of file NetworkSession.php.

◆ encodePacketTimed()

static pocketmine\network\mcpe\NetworkSession::encodePacketTimed ( PacketSerializer $serializer,
ClientboundPacket $packet )
static

Definition at line 558 of file NetworkSession.php.

◆ getBroadcaster()

pocketmine\network\mcpe\NetworkSession::getBroadcaster ( )

Definition at line 605 of file NetworkSession.php.

◆ getCompressor()

pocketmine\network\mcpe\NetworkSession::getCompressor ( )

Definition at line 609 of file NetworkSession.php.

◆ getDisplayName()

pocketmine\network\mcpe\NetworkSession::getDisplayName ( )

Definition at line 319 of file NetworkSession.php.

◆ getEntityEventBroadcaster()

pocketmine\network\mcpe\NetworkSession::getEntityEventBroadcaster ( )

Definition at line 607 of file NetworkSession.php.

◆ getHandler()

pocketmine\network\mcpe\NetworkSession::getHandler ( )

Definition at line 337 of file NetworkSession.php.

◆ getInvManager()

pocketmine\network\mcpe\NetworkSession::getInvManager ( )

Definition at line 1240 of file NetworkSession.php.

◆ getIp()

pocketmine\network\mcpe\NetworkSession::getIp ( )

Definition at line 311 of file NetworkSession.php.

◆ getLogger()

pocketmine\network\mcpe\NetworkSession::getLogger ( )

Definition at line 229 of file NetworkSession.php.

◆ getPing()

pocketmine\network\mcpe\NetworkSession::getPing ( )

Returns the last recorded ping measurement for this session, in milliseconds, or null if a ping measurement has not yet been recorded.

Definition at line 326 of file NetworkSession.php.

◆ getPlayer()

pocketmine\network\mcpe\NetworkSession::getPlayer ( )

Definition at line 299 of file NetworkSession.php.

◆ getPlayerInfo()

pocketmine\network\mcpe\NetworkSession::getPlayerInfo ( )

Definition at line 303 of file NetworkSession.php.

◆ getPort()

pocketmine\network\mcpe\NetworkSession::getPort ( )

Definition at line 315 of file NetworkSession.php.

◆ getTypeConverter()

pocketmine\network\mcpe\NetworkSession::getTypeConverter ( )

Definition at line 613 of file NetworkSession.php.

◆ handleAckReceipt()

pocketmine\network\mcpe\NetworkSession::handleAckReceipt ( int $receiptId)

Definition at line 483 of file NetworkSession.php.

◆ handleDataPacket()

pocketmine\network\mcpe\NetworkSession::handleDataPacket ( Packet $packet,
string $buffer )
Exceptions
PacketHandlingException

Definition at line 428 of file NetworkSession.php.

◆ handleEncoded()

pocketmine\network\mcpe\NetworkSession::handleEncoded ( string $payload)
Exceptions
PacketHandlingException

Definition at line 353 of file NetworkSession.php.

◆ isConnected()

pocketmine\network\mcpe\NetworkSession::isConnected ( )

Definition at line 307 of file NetworkSession.php.

◆ notifyTerrainReady()

pocketmine\network\mcpe\NetworkSession::notifyTerrainReady ( )

Definition at line 950 of file NetworkSession.php.

◆ onActionBar()

pocketmine\network\mcpe\NetworkSession::onActionBar ( string $actionBar)

Definition at line 1271 of file NetworkSession.php.

◆ onChatMessage()

pocketmine\network\mcpe\NetworkSession::onChatMessage ( Translatable|string $message)

Definition at line 1141 of file NetworkSession.php.

◆ onClearTitle()

pocketmine\network\mcpe\NetworkSession::onClearTitle ( )

Definition at line 1275 of file NetworkSession.php.

◆ onClientDisconnect()

pocketmine\network\mcpe\NetworkSession::onClientDisconnect ( Translatable|string $reason)

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.

Definition at line 813 of file NetworkSession.php.

◆ onCloseAllForms()

pocketmine\network\mcpe\NetworkSession::onCloseAllForms ( )

Definition at line 1177 of file NetworkSession.php.

◆ onEnterWorld()

pocketmine\network\mcpe\NetworkSession::onEnterWorld ( )

Definition at line 1222 of file NetworkSession.php.

◆ onFormSent()

pocketmine\network\mcpe\NetworkSession::onFormSent ( int $id,
Form $form )

Definition at line 1173 of file NetworkSession.php.

◆ onItemCooldownChanged()

pocketmine\network\mcpe\NetworkSession::onItemCooldownChanged ( Item $item,
int $ticks )

Definition at line 1295 of file NetworkSession.php.

◆ onJukeboxPopup()

pocketmine\network\mcpe\NetworkSession::onJukeboxPopup ( Translatable|string $message)

Definition at line 1153 of file NetworkSession.php.

◆ onOpenSignEditor()

pocketmine\network\mcpe\NetworkSession::onOpenSignEditor ( Vector3 $signPosition,
bool $frontSide )

Definition at line 1291 of file NetworkSession.php.

◆ onPlayerAdded()

pocketmine\network\mcpe\NetworkSession::onPlayerAdded ( Player $p)

Definition at line 1253 of file NetworkSession.php.

◆ onPlayerDestroyed()

pocketmine\network\mcpe\NetworkSession::onPlayerDestroyed ( Translatable|string $reason,
Translatable|string $disconnectScreenMessage )

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

Definition at line 803 of file NetworkSession.php.

◆ onPlayerRemoved()

pocketmine\network\mcpe\NetworkSession::onPlayerRemoved ( Player $p)

Definition at line 1257 of file NetworkSession.php.

◆ onPopup()

pocketmine\network\mcpe\NetworkSession::onPopup ( string $message)

Definition at line 1165 of file NetworkSession.php.

◆ onResetTitleOptions()

pocketmine\network\mcpe\NetworkSession::onResetTitleOptions ( )

Definition at line 1279 of file NetworkSession.php.

◆ onServerDeath()

pocketmine\network\mcpe\NetworkSession::onServerDeath ( Translatable|string $deathMessage)

Definition at line 964 of file NetworkSession.php.

◆ onServerRespawn()

pocketmine\network\mcpe\NetworkSession::onServerRespawn ( )

Definition at line 970 of file NetworkSession.php.

◆ onSubTitle()

pocketmine\network\mcpe\NetworkSession::onSubTitle ( string $subtitle)

Definition at line 1267 of file NetworkSession.php.

◆ onTip()

pocketmine\network\mcpe\NetworkSession::onTip ( string $message)

Definition at line 1169 of file NetworkSession.php.

◆ onTitle()

pocketmine\network\mcpe\NetworkSession::onTitle ( string $title)

Definition at line 1263 of file NetworkSession.php.

◆ onTitleDuration()

pocketmine\network\mcpe\NetworkSession::onTitleDuration ( int $fadeIn,
int $stay,
int $fadeOut )

Definition at line 1283 of file NetworkSession.php.

◆ onToastNotification()

pocketmine\network\mcpe\NetworkSession::onToastNotification ( string $title,
string $body )

Definition at line 1287 of file NetworkSession.php.

◆ prepareClientTranslatableMessage()

pocketmine\network\mcpe\NetworkSession::prepareClientTranslatableMessage ( Translatable $message)
Returns
string[][] @phpstan-return array{string, string[]}

Definition at line 1134 of file NetworkSession.php.

◆ queueCompressed()

pocketmine\network\mcpe\NetworkSession::queueCompressed ( CompressBatchPromise|string $payload,
bool $immediate = false )

Definition at line 615 of file NetworkSession.php.

◆ sendDataPacket()

pocketmine\network\mcpe\NetworkSession::sendDataPacket ( ClientboundPacket $packet,
bool $immediate = false )

Definition at line 538 of file NetworkSession.php.

◆ sendDataPacketWithReceipt()

pocketmine\network\mcpe\NetworkSession::sendDataPacketWithReceipt ( ClientboundPacket $packet,
bool $immediate = false )

@phpstan-return Promise<true>

Definition at line 545 of file NetworkSession.php.

◆ setHandler()

pocketmine\network\mcpe\NetworkSession::setHandler ( ?PacketHandler $handler)

Definition at line 341 of file NetworkSession.php.

◆ startUsingChunk()

pocketmine\network\mcpe\NetworkSession::startUsingChunk ( int $chunkX,
int $chunkZ,
\Closure $onCompletion )

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

Parameters
\Closure$onCompletionTo be called when chunk sending has completed. @phpstan-param \Closure() : void $onCompletion

Definition at line 1186 of file NetworkSession.php.

◆ stopUsingChunk()

pocketmine\network\mcpe\NetworkSession::stopUsingChunk ( int $chunkX,
int $chunkZ )

Definition at line 1218 of file NetworkSession.php.

◆ syncAbilities()

pocketmine\network\mcpe\NetworkSession::syncAbilities ( Player $for)

Definition at line 1032 of file NetworkSession.php.

◆ syncAdventureSettings()

pocketmine\network\mcpe\NetworkSession::syncAdventureSettings ( )

Definition at line 1079 of file NetworkSession.php.

◆ syncAvailableCommands()

pocketmine\network\mcpe\NetworkSession::syncAvailableCommands ( )

Definition at line 1093 of file NetworkSession.php.

◆ syncGameMode()

pocketmine\network\mcpe\NetworkSession::syncGameMode ( GameMode $mode,
bool $isRollback = false )

Definition at line 1021 of file NetworkSession.php.

◆ syncMovement()

pocketmine\network\mcpe\NetworkSession::syncMovement ( Vector3 $pos,
?float $yaw = null,
?float $pitch = null,
int $mode = MovePlayerPacket::MODE_NORMAL )

Definition at line 979 of file NetworkSession.php.

◆ syncPlayerList()

pocketmine\network\mcpe\NetworkSession::syncPlayerList ( array $players)
Parameters
Player[]$players

Definition at line 1247 of file NetworkSession.php.

◆ syncPlayerSpawnPoint()

pocketmine\network\mcpe\NetworkSession::syncPlayerSpawnPoint ( Position $newSpawn)

Definition at line 1011 of file NetworkSession.php.

◆ syncViewAreaCenterPoint()

pocketmine\network\mcpe\NetworkSession::syncViewAreaCenterPoint ( Vector3 $newPos,
int $viewDistance )

Definition at line 1007 of file NetworkSession.php.

◆ syncViewAreaRadius()

pocketmine\network\mcpe\NetworkSession::syncViewAreaRadius ( int $distance)

Definition at line 1003 of file NetworkSession.php.

◆ syncWorldDifficulty()

pocketmine\network\mcpe\NetworkSession::syncWorldDifficulty ( int $worldDifficulty)

Definition at line 1236 of file NetworkSession.php.

◆ syncWorldSpawnPoint()

pocketmine\network\mcpe\NetworkSession::syncWorldSpawnPoint ( Position $newSpawn)

Definition at line 1017 of file NetworkSession.php.

◆ syncWorldTime()

pocketmine\network\mcpe\NetworkSession::syncWorldTime ( int $worldTime)

Definition at line 1232 of file NetworkSession.php.

◆ tick()

pocketmine\network\mcpe\NetworkSession::tick ( )

Definition at line 1302 of file NetworkSession.php.

◆ transfer()

pocketmine\network\mcpe\NetworkSession::transfer ( string $ip,
int $port,
Translatable|string|null $reason = null )

Instructs the remote client to connect to a different server.

Definition at line 790 of file NetworkSession.php.

◆ updatePing()

pocketmine\network\mcpe\NetworkSession::updatePing ( int $ping)

Definition at line 333 of file NetworkSession.php.


The documentation for this class was generated from the following file: