Getting disconnected from a Singleplayer world causes unexpected behaviour
Closed this issue · 2 comments
When the player is booted from a Singleplayer world in such a way that they would be sent to the Multiplayer screen, AutoReconnect will trigger and attempt to send the player to whatever server they were most recently connected to. If the player hasn't connected to any servers since launching the game, it will instead display a "Could not connect" error.
The simplest way to reproduce is to get kicked from a Singleplayer world for spamming:
- Enter a Singleplayer world where Cheats aren't enabled
- Send a message in chat
- Cyclically press T, up, and enter to send the message repeatedly
- The player will be automatically kicked for spamming, which triggers AutoReconnect. Once the timer expires, AutoReconnect will attempt to send the player to the most recent server they've joined. If none have been joined in the current session, it will display a "Could not connect" error.
The most straightforward fix would be for AutoReconnect to simply not trigger when the player is kicked from Singleplayer, but if I may, I'd like to request that instead this be fixed by having AutoReconnect send the player back into their Singleplayer world. I've been using the Textile Backup mod recently, and when you restore a backup in-game it causes a disconnect to the Multiplayer menu (and triggering AutoReconnect). I downloaded AutoReconnect because I was curious if it would save me a few clicks every time I restore a backup, so I'd be very happy if it could do that. Of course, this isn't even a particularly significant issue in the first place, since I'd assume most players will never experience a Singleplayer disconnect, so it might not warrant a fix anyways.
I noticed that too (weird behaviour with singleplayer worlds) but didn't bother too much since, as you said, most people wont ever get disconnected from a singleplayer world.
There are plans to add support for realms and Ill probably end up rewriting most of the logic anyway, so Ill definitely consider implementing proper reconnects to singleplayer worlds as well - or at least prevent reconnecting to the latest server, which shouldn't happen in the first place, I am pretty sure I took care of that, but there might of course be a bug and you actually found a way to cause it, Ill check on that soon
Now works with the latest release. You can reconnect to a singleplayer world and if you click on the back button you don't end up in the multiplayer menu anymore, which is an official bug I thereby fixed (MC-45602). I hope everything is working fine, but from my testing it seems like it does. Feel free to reopen this issue if you find any issues regarding singleplayer reconnects.