PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
|
Public Member Functions | |
__construct (private PlayerInfo $playerInfo, private string $ip, private int $port, protected bool $authRequired) | |
call () | |
clearAllKickFlags () | |
clearKickFlag (int $flag) | |
getDisconnectReason (int $flag) | |
getDisconnectScreenMessage (int $flag) | |
getEventName () | |
getFinalDisconnectReason () | |
getFinalDisconnectScreenMessage () | |
getIp () | |
getKickFlags () | |
getPlayerInfo () | |
getPort () | |
isAllowed () | |
isAuthRequired () | |
isKickFlagSet (int $flag) | |
setAuthRequired (bool $v) | |
setKickFlag (int $flag, Translatable|string $disconnectReason, Translatable|string|null $disconnectScreenMessage=null) | |
Static Public Member Functions | |
static | hasHandlers () |
Public Attributes | |
const | KICK_FLAG_BANNED = 3 |
const | KICK_FLAG_PLUGIN = 0 |
const | KICK_FLAG_PRIORITY |
const | KICK_FLAG_SERVER_FULL = 1 |
const | KICK_FLAG_SERVER_WHITELISTED = 2 |
Protected Attributes | |
array | $disconnectReasons = [] |
array | $disconnectScreenMessages = [] |
string | $eventName = null |
Called when a player connects to the server, prior to authentication taking place. Set a kick reason to cancel the event and disconnect the player with the kick message set.
This event should be used to decide if the player may continue to login to the server. Do things like checking bans, whitelisting, server-full etc here.
WARNING: Any information about the player CANNOT be trusted at this stage, because they are not authenticated and could be a hacker posing as another player.
Definition at line 42 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::__construct | ( | private PlayerInfo | $playerInfo, |
private string | $ip, | ||
private int | $port, | ||
protected bool | $authRequired ) |
Definition at line 60 of file PlayerPreLoginEvent.php.
|
inherited |
pocketmine\event\player\PlayerPreLoginEvent::clearAllKickFlags | ( | ) |
Clears all pre-assigned kick reasons, allowing the player to continue logging in.
Definition at line 133 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::clearKickFlag | ( | int | $flag | ) |
Clears a specific kick flag if it was set. This allows fine-tuned kick reason removal without impacting other reasons (for example, a ban can be bypassed without accidentally allowing a player to join a full server).
int | $flag | Specific flag to clear. |
Definition at line 126 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::getDisconnectReason | ( | int | $flag | ) |
Returns the disconnect reason provided for the given kick flag, or null if not set. This is the message which will be shown in the server log and on the console.
Definition at line 149 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::getDisconnectScreenMessage | ( | int | $flag | ) |
Returns the disconnect screen message provided for the given kick flag, or null if not set. This is the message shown to the player on the disconnect screen.
Definition at line 157 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::getFinalDisconnectReason | ( | ) |
Resolves the message that will be shown in the server log if the player is kicked. Only one message (the highest priority one) will be shown. See priority order to decide how to set your messages.
Definition at line 168 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::getFinalDisconnectScreenMessage | ( | ) |
Resolves the message that will be shown on the player's disconnect screen if they are kicked. Only one message (the highest priority one) will be shown. See priority order to decide how to set your messages.
Definition at line 185 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::getIp | ( | ) |
Definition at line 76 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::getKickFlags | ( | ) |
Returns an array of kick flags currently assigned.
Definition at line 97 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::getPlayerInfo | ( | ) |
Returns an object containing self-proclaimed information about the connecting player. WARNING: THE PLAYER IS NOT VERIFIED DURING THIS EVENT. At this point, this could be a hacker posing as another player.
Definition at line 72 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::getPort | ( | ) |
Definition at line 80 of file PlayerPreLoginEvent.php.
|
staticinherited |
pocketmine\event\player\PlayerPreLoginEvent::isAllowed | ( | ) |
Returns whether the player is allowed to continue logging in.
Definition at line 141 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::isAuthRequired | ( | ) |
Definition at line 84 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::isKickFlagSet | ( | int | $flag | ) |
Returns whether the given kick flag is set for this event.
Definition at line 104 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::setAuthRequired | ( | bool | $v | ) |
Definition at line 88 of file PlayerPreLoginEvent.php.
pocketmine\event\player\PlayerPreLoginEvent::setKickFlag | ( | int | $flag, |
Translatable|string | $disconnectReason, | ||
Translatable|string|null | $disconnectScreenMessage = null ) |
Sets a reason to disallow the player to continue authenticating, with a message. This can also be used to change kick messages for already-set flags.
Translatable | string | $disconnectReason | Shown in the server log - this should be a short one-line message |
Translatable | string | null | $disconnectScreenMessage | Shown on the player's disconnection screen (null will use the reason) |
Definition at line 115 of file PlayerPreLoginEvent.php.
|
protected |
Definition at line 56 of file PlayerPreLoginEvent.php.
|
protected |
Definition at line 58 of file PlayerPreLoginEvent.php.
|
protectedinherited |
const pocketmine\event\player\PlayerPreLoginEvent::KICK_FLAG_BANNED = 3 |
Definition at line 46 of file PlayerPreLoginEvent.php.
const pocketmine\event\player\PlayerPreLoginEvent::KICK_FLAG_PLUGIN = 0 |
Definition at line 43 of file PlayerPreLoginEvent.php.
const pocketmine\event\player\PlayerPreLoginEvent::KICK_FLAG_PRIORITY |
Definition at line 48 of file PlayerPreLoginEvent.php.
const pocketmine\event\player\PlayerPreLoginEvent::KICK_FLAG_SERVER_FULL = 1 |
Definition at line 44 of file PlayerPreLoginEvent.php.
const pocketmine\event\player\PlayerPreLoginEvent::KICK_FLAG_SERVER_WHITELISTED = 2 |
Definition at line 45 of file PlayerPreLoginEvent.php.