Velocity icon indicating copy to clipboard operation
Velocity copied to clipboard

ServerPostConnectEvent fires before the player connection is complete (Only 1.20.2)

Open VelVeV opened this issue 2 years ago • 6 comments

ServerPostConnectEvent fires before the player connection is complete (Only 1.20.2)

VelVeV avatar Oct 12 '23 12:10 VelVeV

https://github.com/PaperMC/Velocity/pull/1097#discussion_r1355380187

VelVeV avatar Oct 12 '23 15:10 VelVeV

Plugins that use ServerPostConnectEvent cause client errors because the event is fired before the player has completed connecting.

VelVeV avatar Oct 13 '23 04:10 VelVeV

can confirm.

  @Subscribe(order = PostOrder.EARLY)
   public void onPlayerChat(ServerPostConnectEvent event) {
       if (!event.getPlayer().getCurrentServer().isPresent())
           return;
/*        if (event.getPlayer().getCurrentServer().get().getServerInfo().getName().equalsIgnoreCase("hub"))
           return;
       if (event.getPlayer().getCurrentServer().get().getServerInfo().getName().equalsIgnoreCase("hub-02"))
           return;*/
       for (int i = 0; i < 300; i++)
           event.getPlayer().sendMessage(this.message);
   }

the messages are being sent in a weird way, way after the login

SladeHazard avatar Oct 22 '23 11:10 SladeHazard

How is this software breaking bug still not fixed.. Prevents any 1.20.2 players from joining with 1.20.2 Velocity and Viaversion only.. 1.20.1 players can join though

diamkil avatar Nov 29 '23 22:11 diamkil

I generally fail to understand the issue here, and between my sight issues and health, I don't have the means to go crazy testing This event is sent from the join game packet and always has been, there is 0 garauntees that it's safe to send anything like messages as the client is still in the loading screens as it's not in the world yet; No idea what you mean by client errors, and errors induced due to stuff like via are generally not our issue

electronicboy avatar Nov 30 '23 07:11 electronicboy

Sometime client will disconnect with The package is too large or Reading data beyond range when send plugin message with player just join the server. This issue occurs at 1.20.2 and when using my plugin. When I delay the send plugin message pack by 500ms or longer, it will not occur.

Coloryr avatar Jan 05 '24 00:01 Coloryr