SpigotMC / BungeeCord

BungeeCord, the 6th in a generation of server portal suites. Efficiently proxies and maintains connections and transport between multiple Minecraft servers.
https://www.spigotmc.org/go/bungeecord
Other
1.57k stars 1.1k forks source link

Improve ServerDisconnectEvent: Set fallBackServer. #3390

Open MartenM opened 2 years ago

MartenM commented 2 years ago

Feature description

Currently, when the connection to a server is lost, the player gets disconnected from the network. For networks with multiple servers, the player could be sent to another server. This is something that can currently be done with the ServerKickEvent. The ServerDisconnectEvent does not have this option.

My proposal is to make the ServerDisconnectEvent have a nullable field 'fallBackServer`. This could be set to any of the fallback servers by default. Or if the old behaviour is to be maintained left to be NULL.

When the event is fired the field can be changed to manipulate the outcome.

Goal of the feature

Maintain players on the network.

Unfitting alternatives

There are really no alternatives. At least not plugin-wise using the API. Sometimes servers just shutting down doesn't kick players properly and this reason is thrown.

Checking

I will be happy to implement this change. Just need some feedback if this is desirable or not. There might be a good reason this is currently not implemented like this.

MartenM commented 2 years ago

Seems like waterfall has already implemented something like this.

md-5 commented 2 years ago

There are really no alternatives.

The priorities config option does exactly this. They will be sent to each server down the list.

At least not plugin-wise using the API.

Maybe true, at least on an event basis.

MartenM commented 2 years ago

Some plugins (cough one of mine, stumbled on this when users reported it) handle redirects manually differently since it gives users more control over where they are redirected to. The users of these plugins don't really use the config option which results in the connection being dropped. Without an event, I cannot really handle these cases.

Would it be okay with if I made a PR for this to include some sort of event? Either with the disconnect event or a modification of the kick event. This issue has already been discussed earlier in #1851.

neziw commented 2 years ago

Interesting third checkbox 👀

MartenM commented 2 years ago

Interesting third checkbox 👀

I think my dyslexia made that something different at the time of reading....