13
0
geforkt von Mirrors/Velocity

Provide useful information for "unexpectedly disconnected from server"

Fixes #233
Dieser Commit ist enthalten in:
Andrew Steinborn 2019-11-27 01:01:50 -05:00
Ursprung 94035366c2
Commit 467fe34da3
2 geänderte Dateien mit 31 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -17,9 +17,9 @@ import com.velocitypowered.proxy.protocol.packet.LoginPluginMessage;
import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse; import com.velocitypowered.proxy.protocol.packet.LoginPluginResponse;
import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess; import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess;
import com.velocitypowered.proxy.protocol.packet.SetCompression; import com.velocitypowered.proxy.protocol.packet.SetCompression;
import com.velocitypowered.proxy.util.except.QuietException;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import java.io.IOException;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -111,8 +111,19 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
@Override @Override
public void disconnected() { public void disconnected() {
resultFuture if (server.getConfiguration().getPlayerInfoForwardingMode() == PlayerInfoForwarding.LEGACY) {
.completeExceptionally(new IOException("Unexpectedly disconnected from remote server")); resultFuture.completeExceptionally(
new QuietException("The connection to the remote server was unexpectedly closed.\n"
+ "This is usually because the remote server does not have BungeeCord IP forwarding "
+ "correctly enabled.\nSee "
+ "https://docs.velocitypowered.com/en/latest/users/player-info-forwarding.html "
+ "for instructions on how to configure player info forwarding correctly.")
);
} else {
resultFuture.completeExceptionally(
new QuietException("The connection to the remote server was unexpectedly closed.")
);
}
} }
private static ByteBuf createForwardingData(byte[] hmacSecret, String address, private static ByteBuf createForwardingData(byte[] hmacSecret, String address,

Datei anzeigen

@ -0,0 +1,17 @@
package com.velocitypowered.proxy.util.except;
/**
* A special-purpose exception thrown when we want to indicate an error condition but do not want
* to see a large stack trace in logs.
*/
public class QuietException extends Exception {
public QuietException(String message) {
super(message);
}
@Override
public synchronized Throwable fillInStackTrace() {
return this;
}
}