com.jnngl.server.ExceptionHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of totalcomputers Show documentation
Show all versions of totalcomputers Show documentation
Computers in vanilla Minecraft | TotalOS SDK
package com.jnngl.server;
import com.jnngl.server.protocol.ClientboundDisconnectPacket;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
public class ExceptionHandler extends ChannelInboundHandlerAdapter {
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
ClientboundDisconnectPacket s2c_disconnect = new ClientboundDisconnectPacket();
s2c_disconnect.reason = cause.getMessage();
ctx.channel().writeAndFlush(s2c_disconnect);
System.out.println("Disconnected "+ctx.channel().remoteAddress()+": "+cause.getMessage());
ctx.channel().disconnect();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy