Remove unused postinitchannel GeyserServerInitializer

This commit is contained in:
Kas-tle 2024-04-12 05:54:18 -07:00 committed by GitHub
parent ddd47b682a
commit 5e783312c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -80,38 +80,6 @@ public class GeyserServerInitializer extends BedrockServerInitializer {
} }
} }
@Override
protected void postInitChannel(Channel channel) throws Exception {
super.postInitChannel(channel);
channel.pipeline().addLast(new SimpleChannelInboundHandler<ByteBuf>() {
private static final int allowedExceptions = 5;
private static final long delayUntilExceptionsReset = 60;
private long lastException;
private int exceptionCounts;
@Override
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) throws Exception {
ctx.fireChannelRead(msg);
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
final long currentTime = System.currentTimeMillis();
if (currentTime >= lastException + (delayUntilExceptionsReset * 1000)) {
exceptionCounts = 0;
}
lastException = currentTime;
if (exceptionCounts++ > allowedExceptions) {
ctx.pipeline().get(GeyserBedrockPeer.class).close("Too many exceptions created.");
return;
}
super.exceptionCaught(ctx, cause);
}
});
}
@Override @Override
protected BedrockPeer createPeer(Channel channel) { protected BedrockPeer createPeer(Channel channel) {
return new GeyserBedrockPeer(channel, this::createSession); return new GeyserBedrockPeer(channel, this::createSession);