Actually handle that
This commit is contained in:
@@ -44,4 +44,9 @@ public class BackendPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
public void handleUnknown(ByteBuf buf) {
|
public void handleUnknown(ByteBuf buf) {
|
||||||
connection.getProxyPlayer().getConnection().write(buf.retain());
|
connection.getProxyPlayer().getConnection().write(buf.retain());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exception(Throwable throwable) {
|
||||||
|
connection.getProxyPlayer().handleConnectionException(connection.getServerInfo(), throwable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,8 +6,11 @@ import com.velocitypowered.proxy.data.ServerInfo;
|
|||||||
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
import com.velocitypowered.proxy.protocol.MinecraftPacket;
|
||||||
import com.velocitypowered.proxy.protocol.packets.*;
|
import com.velocitypowered.proxy.protocol.packets.*;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
||||||
|
import com.velocitypowered.proxy.util.ThrowableUtils;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.EventLoop;
|
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.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@@ -90,7 +93,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void exception(Throwable throwable) {
|
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) {
|
public void handleBackendJoinGame(JoinGame joinGame) {
|
||||||
|
@@ -81,7 +81,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation {
|
|||||||
handleConnectionException(info, TextComponent.builder()
|
handleConnectionException(info, TextComponent.builder()
|
||||||
.content(userMessage + ": ")
|
.content(userMessage + ": ")
|
||||||
.color(TextColor.RED)
|
.color(TextColor.RED)
|
||||||
.append(TextComponent.of(error))
|
.append(TextComponent.of(error, TextColor.WHITE))
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user