Rewrite documentation for PlayerPreLogin, PlayerLogin and PlayerJoin events

this is some of the most awful documentation I've ever seen. No documentation would have been better.
This commit is contained in:
Dylan K. Taylor 2018-12-23 14:03:19 +00:00
parent de88f0fce1
commit c242d6213a
3 changed files with 19 additions and 3 deletions

View File

@ -27,7 +27,11 @@ use pocketmine\lang\TextContainer;
use pocketmine\Player;
/**
* Called when a player joins the server, after sending all the spawn packets
* Called when the player spawns in the world after logging in, when they first see the terrain.
*
* Note: A lot of data is sent to the player between login and this event. Disconnecting the player during this event
* will cause this data to be wasted. Prefer disconnecting at login-time if possible to minimize bandwidth wastage.
* @see PlayerLoginEvent
*/
class PlayerJoinEvent extends PlayerEvent{
/** @var string|TextContainer */

View File

@ -27,7 +27,9 @@ use pocketmine\event\Cancellable;
use pocketmine\Player;
/**
* Called when a player joins, after things have been correctly set up (you can change anything now)
* Called after the player has successfully authenticated, before it spawns. The player is on the loading screen when
* this is called.
* Cancelling this event will cause the player to be disconnected with the kick message set.
*/
class PlayerLoginEvent extends PlayerEvent implements Cancellable{
/** @var string */

View File

@ -27,7 +27,17 @@ use pocketmine\event\Cancellable;
use pocketmine\Player;
/**
* Called when the player logs in, before things have been set up
* Called when a player connects to the server, prior to authentication taking place.
* Cancelling this event will cause the player to be disconnected 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.
*
* WARNING: Due to internal bad architecture, the player is not fully constructed at this stage, and errors might occur
* when calling API methods on the player. Tread with caution.
*/
class PlayerPreLoginEvent extends PlayerEvent implements Cancellable{
/** @var string */