I disagree. In Bukkit, PlayerQuitEvent
and PlayerKickEvent
were actually completely different - and were called at different points in the pipeline. It confused me too for a while, admittedly.
The PlayerKickEvent
was an event that happened BEFORE the user got kicked. This was cancellable, so if a player was about to be kicked, you could stop that from happening. This event was server-driven - at this point, the client actually had not been kicked yet. User cleanup should not have been performed here, as there was no guarantee that the user was going to be kicked.
The PlayerQuitEvent
, on the other hand, was an event that happened AFTER the user got disconnected, which include being kicked. You can’t stop a user from disconnecting - indeed, the user had gone by this point. This is the logical place to clean up any user resources.
Essentially, the two events don’t serve to confuse, they are two different events for two different point when kicking a player. There is no reason to have an equivalent method to the PlayerKickEvent for when a client disconnects of it’s own accord - because you aren’t going to do anything with it that you would do during disconnect, you sure can’t stop them from disconnecting. Therefore, there would be little point to having an umbrella PlayerDisconnectEvent
for this - it feels to me you’re sugggesting to make another event object for the sake of it.
The PlayerQuitEvent
or whatever the equivalent is in Sponge could have a “disconnect reason” enum or something in the event itself that states whether the player left of their own accord or was kicked. That’d be a better way around it, because then you just had to monitor the disconnect method for the reason, and ignore the kick event, if any.
(I did work on that for Bukkit at one point, but it sat there for 4/5 months (with some interaction), got bitrotted, and after rebasing it multiple times for multiple versions, I just gave up - funnily enough, it was to solve this problem…)