Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
Actually handle that
Dieser Commit ist enthalten in:
Ursprung
64ff0683c9
Commit
201c484247
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren