Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
Bugfix -> Fixed error when no packet-decoder found
Browse files Browse the repository at this point in the history
  • Loading branch information
EinfacheSache committed Sep 20, 2023
1 parent d235b03 commit 6fb94e8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
}

public void addKeepAlivePacketHandler(Channel channel, AtomicReference<InetSocketAddress> inetAddress, NeoProtectPlugin instance) {
if (!channel.pipeline().names().contains(PipelineUtils.PACKET_DECODER)) {
instance.getCore().warn("Failed to add KeepAlivePacketHandler (packet-decoder can't be found)");
return;
}

channel.pipeline().addAfter(PipelineUtils.PACKET_DECODER, "neo-keep-alive-handler", new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
}

public void addKeepAlivePacketHandler(Channel channel, AtomicReference<InetSocketAddress> inetAddress, VelocityServer velocityServer, NeoProtectPlugin instance) {
if (!channel.pipeline().names().contains("minecraft-decoder")) {
instance.getCore().warn("Failed to add KeepAlivePacketHandler (minecraft-decoder can't be found)");
return;
}

channel.pipeline().addAfter("minecraft-decoder", "neo-keep-alive-handler", new ChannelInboundHandlerAdapter() {
@Override
Expand Down

0 comments on commit 6fb94e8

Please sign in to comment.