Skip to content

NetworkSessionManager ​

class · pocketmine\network\NetworkSessionManager · source

Methods ​

add() ​

php
public function add(\pocketmine\network\mcpe\NetworkSession $session) : void

Adds a network session to the manager. This should only be called on session creation.

close() ​

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

Terminates all connected sessions with the given reason.

getSessionCount() ​

php
public function getSessionCount() : int

Returns the number of known connected sessions, including sessions which have not yet sent a login request.

getSessions() ​

php
public function getSessions() : array

getValidSessionCount() ​

php
public function getValidSessionCount() : int

Returns the number of connected sessions which have either sent a login request, or have already completed the login sequence.

markLoginReceived() ​

php
public function markLoginReceived(\pocketmine\network\mcpe\NetworkSession $session) : void

Marks the session as having sent a login request. After this point, they are counted towards the total player count.

remove() ​

php
public function remove(\pocketmine\network\mcpe\NetworkSession $session) : void

Removes the given network session, due to disconnect. This should only be called by a network session on disconnection.

tick() ​

php
public function tick() : void

Updates all sessions which need it.

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