Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.43k stars 382 forks source link

Race condition in greet player hook? MotD regularly not displaying #1825

Closed QuiCM closed 4 years ago

QuiCM commented 4 years ago

Often the MotD does not display when connecting to the server. Olink in Discord: If you run the code to send the motd to the player in a delayed task for 1-2 seconds it works everytime

hakusaro commented 4 years ago

Seems like this might be a vanilla bug based on the fact that playerGreet is when vanilla sends its MOTD.

Olink commented 4 years ago

I poked around this today, it looks like you can use the Terraria.Chat.ChatHelper.SendChatMessageToClient method (which is what vanilla uses) to fix this issue. I think there might be a scenario where the client drops chat packets through the normal method we send chat messages.

QuiCM commented 4 years ago

Seems to be resolved in https://github.com/Pryaxis/TShock/commit/83eb707761dc37ebb0b7a90aadeca5896fb568f0