SpongePowered / SpongeAPI

A Minecraft plugin API
http://www.spongepowered.org/
MIT License
1.14k stars 342 forks source link

Make ServersideConnectionEvent.Handshake a Cancellable MessageEvent, like Auth #2461

Open A248 opened 1 year ago

A248 commented 1 year ago

Major SpongeAPI version

9

Is this likely to be a breaking change?

No

What are you requesting?

There are good reasons plugins may want to cancel the Handshake event. Unlike the Auth event, the player's correct UUID is available, such as when player info forwarding is configured. Unlike the Login event, the Handshake is asynchronous, which allows plugins to do more work there.

"Canceling" the Handshake event is currently possible by closing the associated connection, as noted in the javadoc.

Some plugins may depend on the player's UUID and issue a database request, for example, to determine whether the player may join. The Handshake event is an ideal event for doing so. It should support cancellation and message-setting, like the Auth event, to better facilitate cancellation and use of the event.