PocketMine-MP
PocketMine-MP copied to clipboard
Add a comment for PlayerCreationEvent::setBaseClass
Description
PlayerCreationEvent has a method set/getBaseClass(), probably not used by PM. I think we need to explain what it does when used.
Alternatively, create a DeveloperDocs document.
Justification
Add a comment or document
Alternative methods
You see the code: https://github.com/pmmp/PocketMine-MP/blob/4102205ba6b9d4172efaa92a2d0d0035b46e8b08/src/pocketmine/event/player/PlayerCreationEvent.php
Hello, what do you think about this issue?
If we are to keep the event, yes, this should be documented properly. To be exact, every non-intuitive function should be documented. We just don't have the time to do that. Pull requests are welcome.
Yes, I tried to add documentation for this function in PR, but I couldn't figure out what the function was for. I searched where the function was used, but the value didn't seem to be used at all.
It is used to allow multiple plugins to use PlayerCreationEvent.
If plugin A has class Foo extends Player, plugin B can do class Bar extends Player, and run their PlayerCreationEvent handler after plugin A. This allows featured of plugin A to remain while plugin B can add new features.
Nevertheless, it is very stupid to keep extending classes like that. PlayerCreationEvent must not be used unless absolutely necessary, and typically only appears in private plugins, in which case there shouldn't be two plugins anyway.
There's an argument to be made for deprecating this function (and even the whole event) entirely ...
and even the whole event
Why delete? Many people use this to change the logic of PocketMine-MP or implement their own API.
For example. It is convenient for servers with mini-games to keep information about the game in which the player is located.
Or you can store information about the player's account directly in his object.
Isn't it convenient?
and even the whole event
Why delete? Many people use this to change the logic of PocketMine-MP or implement their own API.
For example. It is convenient for servers with mini-games to keep information about the game in which the player is located.
Or you can store information about the player's account directly in his object.
Isn't it convenient?
this :clap: is :clap: not :clap: what :clap: PlayerCreationEvent :clap: was :clap: made :clap: for
if you want to store objects associated with a player, maintain your own array in the plugin. Alternatively, something like #4471 might be useful.
Why delete? Many people use this to change the logic of PocketMine-MP or implement their own API.
For example. It is convenient for servers with mini-games to keep information about the game in which the player is located.
Or you can store information about the player's account directly in his object.
Isn't it convenient?
You just made our case for removing it - people like yourself keep abusing it for things it wasn't intended for.
See also: #3473
@SOF3 @dktapps
thanks