Event handler handles PostLoginEvent instead of LoginEvent
In order to suppress setState(PLAY)
This commit is contained in:
parent
594aa4ccea
commit
28ebcd76fa
|
|
@ -76,8 +76,6 @@ public enum VelocityForgeBackendConnectionPhase implements BackendConnectionPhas
|
|||
}
|
||||
}
|
||||
message.retain();
|
||||
// dirty hack for 1.20.2 velocity!
|
||||
player.getConnection().setState(StateRegistry.LOGIN);
|
||||
player.getConnection().write(message);
|
||||
//Forge server
|
||||
//To avoid unnecessary resets, we wait until we get the handshake even if we know that we should
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ public class VelocityEventHandler {
|
|||
this.ambassador = ambassador;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onLoginEvent(LoginEvent event, Continuation continuation) {
|
||||
@Subscribe(order = PostOrder.FIRST)
|
||||
public void onPostLoginEvent(PostLoginEvent event, Continuation continuation) {
|
||||
ConnectedPlayer player = (ConnectedPlayer) event.getPlayer();
|
||||
if (player.getPhase() instanceof VelocityForgeClientConnectionPhase) {
|
||||
((VelocityServer) Ambassador.getInstance().server).unregisterConnection(player);
|
||||
|
||||
player.getConnection().eventLoop().submit(() -> {
|
||||
player.getConnection().setState(StateRegistry.LOGIN);
|
||||
|
||||
|
|
@ -43,14 +45,6 @@ public class VelocityEventHandler {
|
|||
ForgeConstants.FORGE_HANDSHAKE_HANDLER, new ForgeLoginWrapperHandler(player));
|
||||
});
|
||||
}
|
||||
//event.getPlayer().sendMessage(Component.text("login event"));
|
||||
continuation.resume();
|
||||
}
|
||||
|
||||
@Subscribe(order = PostOrder.FIRST)
|
||||
public void onPostLoginEvent(PostLoginEvent event, Continuation continuation) {
|
||||
if (((ConnectedPlayer) event.getPlayer()).getPhase() instanceof VelocityForgeClientConnectionPhase)
|
||||
((VelocityServer) Ambassador.getInstance().server).unregisterConnection((ConnectedPlayer) event.getPlayer());
|
||||
//event.getPlayer().sendMessage(Component.text("post login event"));
|
||||
continuation.resume();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user