13
0
geforkt von Mirrors/Velocity

Actually handle that

Dieser Commit ist enthalten in:
Andrew Steinborn 2018-07-29 22:31:41 -04:00
Ursprung 64ff0683c9
Commit 201c484247
3 geänderte Dateien mit 14 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -44,4 +44,9 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
public void handleUnknown(ByteBuf buf) {
connection.getProxyPlayer().getConnection().write(buf.retain());
}
@Override
public void exception(Throwable throwable) {
connection.getProxyPlayer().handleConnectionException(connection.getServerInfo(), throwable);
}
}

Datei anzeigen

@ -6,8 +6,11 @@ import com.velocitypowered.proxy.data.ServerInfo;
import com.velocitypowered.proxy.protocol.MinecraftPacket;
import com.velocitypowered.proxy.protocol.packets.*;
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
import com.velocitypowered.proxy.util.ThrowableUtils;
import io.netty.buffer.ByteBuf;
import io.netty.channel.EventLoop;
import net.kyori.text.TextComponent;
import net.kyori.text.format.TextColor;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -90,7 +93,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
@Override
public void exception(Throwable throwable) {
player.handleConnectionException(player.getConnectedServer().getServerInfo(), throwable);
player.close(TextComponent.builder()
.content("An exception occurred in your connection: ")
.color(TextColor.RED)
.append(TextComponent.of(ThrowableUtils.briefDescription(throwable), TextColor.WHITE))
.build());
}
public void handleBackendJoinGame(JoinGame joinGame) {

Datei anzeigen

@ -81,7 +81,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation {
handleConnectionException(info, TextComponent.builder()
.content(userMessage + ": ")
.color(TextColor.RED)
.append(TextComponent.of(error))
.append(TextComponent.of(error, TextColor.WHITE))
.build());
}