Closed GoldenDelicios closed 2 years ago
I'll look into this because bouncer is likely the most sensible level to address this, iceboxing until july 19th because thesis though since it's not exactly gamebreaking
Found a small leftover threading inconsistency in the Bouncer that could potentially cause this, hopefully my change fixes it come next restart - might have to get back to this and investigate more thoroughly though
This still happens: https://discord.com/channels/146701388234227712/596920517643206656/913302467414999072
First "real" join (#console) https://discord.com/channels/146701388234227712/596920414232510465/913302490747928606
Looking into this as well as #45
This is down to clients double joining at times - it's something we can't really avoid I think?
The issue is caused by a user joining the server while it's still starting up. The second message is a second attempt by the user to join after being kicked.
The correct behavior would be to either ignore the failed login attempt, or correctly log the disconnect event that happens right after.
There's an interesting behavior in which the server's player list does not yet contain the joining player in ServerConnectedEvent, but does in ServerSwitchEvent. I tried to see if joining during startup could cause the first event to fire without the second, but haven't been able to on a local setup. This might be easier to reproduce on Slab with higher ping and a longer startup time with all the plugins, so I've added a small plugin to the proxy to log when the relevant events happen.
Two suggested solutions:
Bouncer#onPlayerDisconnect
to use ServerDisconnectEvent
instead of PlayerDisconnectEvent
.
Bouncer#smpJoin
to use ServerSwitchEvent
and check if event.getFrom() == null
(i.e. a not arriving from a previous server) instead of ServerConnectedEvent
.
Chris has offered to look at this if he finds time - if that's not in the next month or two we'll just close this as a won't finish
Implemented the first suggestion and put it on the proxy - next restart should activate it
The first suggestion caused player disconnected and player connected messages on server switches between MW and RW
The second suggestion is not implementable without loosing the warning message that states:
As long as the main world is empty, Discord cannot be properly connected. Sorry. We will fix it later!
which tbf is a lie, seeing as we're not gonna fix it, but I think this message is more important than not having double join messages on a fringe case (as in, server restarts)
This is a rare and harmless enough issue we're not going to spend further time addressing this - closing!
Players joining as soon as the server restarts may cause two join messages to appear, both in-game and in Discord. Examples: https://discord.com/channels/146701388234227712/147017948912025601/848231718850789406 https://discord.com/channels/146701388234227712/596920517643206656/848229403304394803 https://discord.com/channels/146701388234227712/596920517643206656/846779847790690354
This seems to be caused by players trying to join the server just before it is ready to accept new connections.
May be related to #33.