New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Player): introduce PlayerPacketHandlerChangeEvent
#6194
base: minor-next
Are you sure you want to change the base?
feat(Player): introduce PlayerPacketHandlerChangeEvent
#6194
Conversation
What's the use case? |
return $this->handler; | ||
} | ||
|
||
public function setHandler(?PacketHandler $handler) : void{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this. This opens lots of options to break things.
use pocketmine\network\mcpe\handler\PacketHandler; | ||
use pocketmine\network\mcpe\NetworkSession; | ||
|
||
class PlayerPacketHandlerChangeEvent extends Event{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Misleading to refer to this as "player" and to put it in this namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without creating a new namespace it has to be either event/player
or event/server
Check out this example. This plugin overrides the default Login packet handler to support WaterdogPE's login extras. However, it currently listens for all incoming packets, making the override process less than optimal in terms of convenience. |
WaterdogPE's design in general is less than optimal ... |
I find this thing interesting because I have to do a hack to deactivate a handler because I have a synchronization system and it's me who manages the call that makes the setHandler(InGameHandler), WaterdogPE could make a new packets but they didn't and I find that a shame |
3b8e1f7
to
bc3e9d6
Compare
Introduction
Relevant issues
Changes
API changes
Behavioural changes
NetworkSession->setHandler(PacketHandler)
now firesPlayerPacketHandlerChangeEvent
Backwards compatibility
Follow-up
Tests