Skip to content

PlayerDisconnectEventTrait ​

trait · pocketmine\event\player\PlayerDisconnectEventTrait · source

Methods ​

getDisconnectReason() ​

php
public function getDisconnectReason() : \pocketmine\lang\Translatable|string

Returns the kick reason shown in the server log and on the console. When kicked by the /kick command, the default is something like "Kicked by admin.".

getDisconnectScreenMessage() ​

php
public function getDisconnectScreenMessage() : \pocketmine\lang\Translatable|string|null

Returns the message shown on the player's disconnection screen. When kicked by the /kick command, the default is something like "Kicked by admin.". If this is null, the kick reason will be used as the disconnect screen message directly.

setDisconnectReason() ​

php
public function setDisconnectReason(\pocketmine\lang\Translatable|string $disconnectReason) : void

Sets the kick reason shown in the server log and on the console.

This should be a short, simple, single-line message. Do not use long or multi-line messages here - they will spam the log and server console with useless information.

setDisconnectScreenMessage() ​

php
public function setDisconnectScreenMessage(\pocketmine\lang\Translatable|string|null $disconnectScreenMessage) : void

Sets the message shown on the player's disconnection screen. This can be as long as you like, and may contain formatting and newlines. If this is set to null, the kick reason will be used as the disconnect screen message directly.

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