Punishment & Profile loading

Hello all,
I am currently wanting to load player data from MongoDB on player join. One problem that I have faced is that players may join before they are disconnected from being banned and also players can be on the server when their profile data has not been loaded (although this is a very small time). Would it be viable if I load all of this on ClientConnectionEvent.Auth and perform the queries on the auth thread so all player data and punishments are loaded before full player log in?
Thanks in advance.

I think that should work.

Since the Auth event is cancellable, you’d probably want to only execute database queries if the event is not cancelled, so add the following to the event listener:

@Listener(order = Order.POST)
public void onClientAuth(ClientConnectionEvent.Auth event) {

This should execute after other plugins have ran their logic and only if the event has not been cancelled in the mean time.

@Simon816, I thought all of the documentation pretty much indicates that if an event is cancelled, then no other plugin event listeners will fire, and you have to override to force it listening to cancelled events…

Has that changed?

By default listeners will not be called if an event is cancelled. You can use @IsCancelled to change this behavior. In this case, I suggested using Tristate.FALSE so that the listener is only executed if a plugin hasn’t cancelled the event.

I now realize that @IsCancelled(Tristate.FALSE) is the default but I made is explicit anyway.