13
0
geforkt von Mirrors/Velocity

Allow fallback to other server connections in the event of an exception.

Also removes some debugging code.
Dieser Commit ist enthalten in:
Andrew Steinborn 2019-03-10 14:11:24 -04:00
Ursprung f16e67cfad
Commit 432d570474
3 geänderte Dateien mit 3 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -8,7 +8,6 @@ import com.google.gson.GsonBuilder;
import com.velocitypowered.api.event.EventManager;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.event.proxy.ProxyReloadEvent;
import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
import com.velocitypowered.api.plugin.PluginContainer;
import com.velocitypowered.api.plugin.PluginManager;
import com.velocitypowered.api.proxy.Player;
@ -50,7 +49,6 @@ import java.nio.file.Paths;
import java.security.KeyPair;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;

Datei anzeigen

@ -31,6 +31,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
private final VelocityServer server;
private final VelocityServerConnection serverConn;
private final ClientPlaySessionHandler playerSessionHandler;
private boolean exceptionTriggered = false;
BackendPlaySessionHandler(VelocityServer server, VelocityServerConnection serverConn) {
this.server = server;
@ -167,6 +168,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
@Override
public void exception(Throwable throwable) {
exceptionTriggered = true;
serverConn.getPlayer().handleConnectionException(serverConn.getServer(), throwable);
}
@ -177,7 +179,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
@Override
public void disconnected() {
serverConn.getServer().removePlayer(serverConn.getPlayer());
if (!serverConn.isGracefulDisconnect()) {
if (!serverConn.isGracefulDisconnect() && !exceptionTriggered) {
serverConn.getPlayer().disconnect(ConnectionMessages.UNEXPECTED_DISCONNECT);
}
}

Datei anzeigen

@ -667,8 +667,6 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
return;
}
System.out.println(status);
switch (status.getStatus()) {
case ALREADY_CONNECTED:
sendMessage(ConnectionMessages.ALREADY_CONNECTED);