Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-06 00:00:47 +01:00
Allow fallback to other server connections in the event of an exception.
Also removes some debugging code.
Dieser Commit ist enthalten in:
Ursprung
f16e67cfad
Commit
432d570474
@ -8,7 +8,6 @@ import com.google.gson.GsonBuilder;
|
|||||||
import com.velocitypowered.api.event.EventManager;
|
import com.velocitypowered.api.event.EventManager;
|
||||||
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
|
||||||
import com.velocitypowered.api.event.proxy.ProxyReloadEvent;
|
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.PluginContainer;
|
||||||
import com.velocitypowered.api.plugin.PluginManager;
|
import com.velocitypowered.api.plugin.PluginManager;
|
||||||
import com.velocitypowered.api.proxy.Player;
|
import com.velocitypowered.api.proxy.Player;
|
||||||
@ -50,7 +49,6 @@ import java.nio.file.Paths;
|
|||||||
import java.security.KeyPair;
|
import java.security.KeyPair;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -31,6 +31,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
private final VelocityServer server;
|
private final VelocityServer server;
|
||||||
private final VelocityServerConnection serverConn;
|
private final VelocityServerConnection serverConn;
|
||||||
private final ClientPlaySessionHandler playerSessionHandler;
|
private final ClientPlaySessionHandler playerSessionHandler;
|
||||||
|
private boolean exceptionTriggered = false;
|
||||||
|
|
||||||
BackendPlaySessionHandler(VelocityServer server, VelocityServerConnection serverConn) {
|
BackendPlaySessionHandler(VelocityServer server, VelocityServerConnection serverConn) {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
@ -167,6 +168,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exception(Throwable throwable) {
|
public void exception(Throwable throwable) {
|
||||||
|
exceptionTriggered = true;
|
||||||
serverConn.getPlayer().handleConnectionException(serverConn.getServer(), throwable);
|
serverConn.getPlayer().handleConnectionException(serverConn.getServer(), throwable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +179,7 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
@Override
|
@Override
|
||||||
public void disconnected() {
|
public void disconnected() {
|
||||||
serverConn.getServer().removePlayer(serverConn.getPlayer());
|
serverConn.getServer().removePlayer(serverConn.getPlayer());
|
||||||
if (!serverConn.isGracefulDisconnect()) {
|
if (!serverConn.isGracefulDisconnect() && !exceptionTriggered) {
|
||||||
serverConn.getPlayer().disconnect(ConnectionMessages.UNEXPECTED_DISCONNECT);
|
serverConn.getPlayer().disconnect(ConnectionMessages.UNEXPECTED_DISCONNECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -667,8 +667,6 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(status);
|
|
||||||
|
|
||||||
switch (status.getStatus()) {
|
switch (status.getStatus()) {
|
||||||
case ALREADY_CONNECTED:
|
case ALREADY_CONNECTED:
|
||||||
sendMessage(ConnectionMessages.ALREADY_CONNECTED);
|
sendMessage(ConnectionMessages.ALREADY_CONNECTED);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren