PocketMine-MP 5.23.3 git-976fc63567edab7a6fb6aeae739f43cf9fe57de4
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 197 of file NetworkSession.php.

Member Function Documentation

◆ addToSendBuffer()

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

Definition at line 576 of file NetworkSession.php.

◆ createPlayer()

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

Definition at line 253 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 762 of file NetworkSession.php.

◆ disconnectIncompatibleProtocol()

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

Definition at line 782 of file NetworkSession.php.

◆ disconnectWithError()

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

Definition at line 773 of file NetworkSession.php.

◆ encodePacketTimed()

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

Definition at line 562 of file NetworkSession.php.

◆ getBroadcaster()

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

Definition at line 609 of file NetworkSession.php.

◆ getCompressor()

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

Definition at line 613 of file NetworkSession.php.

◆ getDisplayName()

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

Definition at line 322 of file NetworkSession.php.

◆ getEntityEventBroadcaster()

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

Definition at line 611 of file NetworkSession.php.

◆ getHandler()

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

Definition at line 340 of file NetworkSession.php.

◆ getInvManager()

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

Definition at line 1254 of file NetworkSession.php.

◆ getIp()

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

Definition at line 314 of file NetworkSession.php.

◆ getLogger()

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

Definition at line 232 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 329 of file NetworkSession.php.

◆ getPlayer()

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

Definition at line 302 of file NetworkSession.php.

◆ getPlayerInfo()

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

Definition at line 306 of file NetworkSession.php.

◆ getPort()

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

Definition at line 318 of file NetworkSession.php.

◆ getTypeConverter()

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

Definition at line 617 of file NetworkSession.php.

◆ handleAckReceipt()

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

Definition at line 486 of file NetworkSession.php.

◆ handleDataPacket()

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

Definition at line 431 of file NetworkSession.php.

◆ handleEncoded()

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

Definition at line 356 of file NetworkSession.php.

◆ isConnected()

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

Definition at line 310 of file NetworkSession.php.

◆ notifyTerrainReady()

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

Definition at line 954 of file NetworkSession.php.

◆ onActionBar()

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

Definition at line 1285 of file NetworkSession.php.

◆ onChatMessage()

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

Definition at line 1144 of file NetworkSession.php.

◆ onClearTitle()

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

Definition at line 1289 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 817 of file NetworkSession.php.

◆ onCloseAllForms()

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

Definition at line 1180 of file NetworkSession.php.

◆ onEnterWorld()

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

Definition at line 1236 of file NetworkSession.php.

◆ onFormSent()

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

Definition at line 1176 of file NetworkSession.php.

◆ onItemCooldownChanged()

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

Definition at line 1309 of file NetworkSession.php.

◆ onJukeboxPopup()

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

Definition at line 1156 of file NetworkSession.php.

◆ onOpenSignEditor()

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

Definition at line 1305 of file NetworkSession.php.

◆ onPlayerAdded()

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

Definition at line 1267 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 807 of file NetworkSession.php.

◆ onPlayerRemoved()

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

Definition at line 1271 of file NetworkSession.php.

◆ onPopup()

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

Definition at line 1168 of file NetworkSession.php.

◆ onResetTitleOptions()

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

Definition at line 1293 of file NetworkSession.php.

◆ onServerDeath()

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

Definition at line 968 of file NetworkSession.php.

◆ onServerRespawn()

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

Definition at line 974 of file NetworkSession.php.

◆ onSubTitle()

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

Definition at line 1281 of file NetworkSession.php.

◆ onTip()

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

Definition at line 1172 of file NetworkSession.php.

◆ onTitle()

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

Definition at line 1277 of file NetworkSession.php.

◆ onTitleDuration()

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

Definition at line 1297 of file NetworkSession.php.

◆ onToastNotification()

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

Definition at line 1301 of file NetworkSession.php.

◆ prepareClientTranslatableMessage()

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

Definition at line 1137 of file NetworkSession.php.

◆ queueCompressed()

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

Definition at line 619 of file NetworkSession.php.

◆ sendDataPacket()

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

Definition at line 541 of file NetworkSession.php.

◆ sendDataPacketWithReceipt()

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

@phpstan-return Promise<true>

Definition at line 548 of file NetworkSession.php.

◆ setHandler()

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

Definition at line 344 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 1202 of file NetworkSession.php.

◆ stopUsingChunk()

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

Definition at line 1232 of file NetworkSession.php.

◆ syncAbilities()

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

Definition at line 1036 of file NetworkSession.php.

◆ syncAdventureSettings()

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

Definition at line 1082 of file NetworkSession.php.

◆ syncAvailableCommands()

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

Definition at line 1096 of file NetworkSession.php.

◆ syncGameMode()

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

Definition at line 1025 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 983 of file NetworkSession.php.

◆ syncPlayerList()

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

Definition at line 1261 of file NetworkSession.php.

◆ syncPlayerSpawnPoint()

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

Definition at line 1015 of file NetworkSession.php.

◆ syncViewAreaCenterPoint()

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

Definition at line 1011 of file NetworkSession.php.

◆ syncViewAreaRadius()

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

Definition at line 1007 of file NetworkSession.php.

◆ syncWorldDifficulty()

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

Definition at line 1250 of file NetworkSession.php.

◆ syncWorldSpawnPoint()

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

Definition at line 1021 of file NetworkSession.php.

◆ syncWorldTime()

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

Definition at line 1246 of file NetworkSession.php.

◆ tick()

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

Definition at line 1316 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 794 of file NetworkSession.php.

◆ updatePing()

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

Definition at line 336 of file NetworkSession.php.


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