PocketMine-MP 5.21.2 git-a6534ecbbbcf369264567d27e5ed70f7f5be9816
|
Public Member Functions | |
__construct (private NetworkSession $session) | |
call () | |
getAddress () | |
getBaseClass () | |
getEventName () | |
getNetworkSession () | |
getPlayerClass () | |
getPort () | |
setBaseClass (string $class) | |
setPlayerClass (string $class) | |
Static Public Member Functions | |
static | hasHandlers () |
Protected Attributes | |
string | $eventName = null |
Allows the use of custom Player classes. This enables overriding built-in Player methods to change behaviour that is not possible to alter any other way.
You probably don't need this event, and found your way here because you looked at some code in an old plugin that abused it (very common). Instead of using custom player classes, you should consider making session classes instead.
This event is a power-user feature, and multiple plugins using it at the same time will conflict and break unless they've been designed to work together. This means that it's only usually useful in private plugins.
WARNING: This should NOT be used for adding extra functions or properties. This is intended for overriding existing core behaviour, and should only be used if you know EXACTLY what you're doing. Custom player classes may break in any update without warning. This event isn't much more than glorified reflection.
Definition at line 48 of file PlayerCreationEvent.php.
pocketmine\event\player\PlayerCreationEvent::__construct | ( | private NetworkSession | $session | ) |
Definition at line 55 of file PlayerCreationEvent.php.
|
inherited |
pocketmine\event\player\PlayerCreationEvent::getAddress | ( | ) |
Definition at line 61 of file PlayerCreationEvent.php.
pocketmine\event\player\PlayerCreationEvent::getBaseClass | ( | ) |
Returns the base class that the final player class must extend.
@phpstan-return class-string<Player>
Definition at line 74 of file PlayerCreationEvent.php.
pocketmine\event\player\PlayerCreationEvent::getNetworkSession | ( | ) |
Definition at line 57 of file PlayerCreationEvent.php.
pocketmine\event\player\PlayerCreationEvent::getPlayerClass | ( | ) |
Returns the class that will be instantiated to create the player after the event.
@phpstan-return class-string<Player>
Definition at line 98 of file PlayerCreationEvent.php.
pocketmine\event\player\PlayerCreationEvent::getPort | ( | ) |
Definition at line 65 of file PlayerCreationEvent.php.
|
staticinherited |
pocketmine\event\player\PlayerCreationEvent::setBaseClass | ( | string | $class | ) |
Sets the class that the final player class must extend. The new base class must be a subclass of the current base class. This can (perhaps) be used to limit the options for custom player classes provided by other plugins.
@phpstan-param class-string<Player> $class
Definition at line 85 of file PlayerCreationEvent.php.
pocketmine\event\player\PlayerCreationEvent::setPlayerClass | ( | string | $class | ) |
Sets the class that will be instantiated to create the player after the event. The class must not be abstract, and must be an instance of the base class.
@phpstan-param class-string<Player> $class
Definition at line 108 of file PlayerCreationEvent.php.
|
protectedinherited |