diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/BadPacketException.java b/protocol/src/main/java/net/md_5/bungee/protocol/BadPacketException.java new file mode 100644 index 00000000..523aeafc --- /dev/null +++ b/protocol/src/main/java/net/md_5/bungee/protocol/BadPacketException.java @@ -0,0 +1,10 @@ +package net.md_5.bungee.protocol; + +public class BadPacketException extends RuntimeException +{ + + public BadPacketException(String message) + { + super( message ); + } +} diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Vanilla.java b/protocol/src/main/java/net/md_5/bungee/protocol/Vanilla.java index 48dc78c0..a443dbc5 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/Vanilla.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/Vanilla.java @@ -78,7 +78,7 @@ public class Vanilla implements Protocol DefinedPacket packet = read( packetId, buf, this ); if ( buf.readerIndex() == start ) { - throw new RuntimeException( "Unknown packet id " + packetId ); + throw new BadPacketException( "Unknown packet id " + packetId ); } return packet; } diff --git a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java index 3160a501..d3a59eef 100644 --- a/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java +++ b/proxy/src/main/java/net/md_5/bungee/netty/HandlerBoss.java @@ -10,6 +10,7 @@ import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.connection.CancelSendSignal; import net.md_5.bungee.connection.InitialHandler; import net.md_5.bungee.connection.PingHandler; +import net.md_5.bungee.protocol.BadPacketException; /** * This class is a primitive wrapper for {@link PacketHandler} instances tied to @@ -95,6 +96,9 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter if ( cause instanceof ReadTimeoutException ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, handler + " - read timed out" ); + } else if ( cause instanceof BadPacketException ) + { + ProxyServer.getInstance().getLogger().log( Level.WARNING, handler + " - bad packet ID, are mods in use!?" ); } else if ( cause instanceof IOException ) { ProxyServer.getInstance().getLogger().log( Level.WARNING, handler + " - IOException: " + cause.getMessage() );