diff --git a/proxy/src/main/java/net/md_5/bungee/packet/DefinedPacket.java b/proxy/src/main/java/net/md_5/bungee/packet/DefinedPacket.java index 64bfbf6f..b8ccdead 100644 --- a/proxy/src/main/java/net/md_5/bungee/packet/DefinedPacket.java +++ b/proxy/src/main/java/net/md_5/bungee/packet/DefinedPacket.java @@ -109,10 +109,7 @@ public abstract class DefinedPacket implements DataInput, DataOutput @Override public abstract String toString(); - public void handle(PacketHandler handler) throws Exception - { - handler.handle( this ); - } + public abstract void handle(PacketHandler handler) throws Exception; private static Class[] classes = new Class[ 256 ]; public static DefinedPacket packet(byte[] buf) diff --git a/proxy/src/main/java/net/md_5/bungee/packet/Packet0KeepAlive.java b/proxy/src/main/java/net/md_5/bungee/packet/Packet0KeepAlive.java index 55427c85..310d99ed 100644 --- a/proxy/src/main/java/net/md_5/bungee/packet/Packet0KeepAlive.java +++ b/proxy/src/main/java/net/md_5/bungee/packet/Packet0KeepAlive.java @@ -15,4 +15,10 @@ public class Packet0KeepAlive extends DefinedPacket super( 0x00, buffer ); id = readInt(); } + + @Override + public void handle(PacketHandler handler) throws Exception + { + handler.handle( this ); + } } diff --git a/proxy/src/main/java/net/md_5/bungee/packet/Packet3Chat.java b/proxy/src/main/java/net/md_5/bungee/packet/Packet3Chat.java index 3631091a..7b0a1525 100644 --- a/proxy/src/main/java/net/md_5/bungee/packet/Packet3Chat.java +++ b/proxy/src/main/java/net/md_5/bungee/packet/Packet3Chat.java @@ -21,4 +21,10 @@ public class Packet3Chat extends DefinedPacket super( 0x03, buf ); this.message = readUTF(); } + + @Override + public void handle(PacketHandler handler) throws Exception + { + handler.handle( this ); + } } diff --git a/proxy/src/main/java/net/md_5/bungee/packet/Packet9Respawn.java b/proxy/src/main/java/net/md_5/bungee/packet/Packet9Respawn.java index a9ff0193..2619d3f8 100644 --- a/proxy/src/main/java/net/md_5/bungee/packet/Packet9Respawn.java +++ b/proxy/src/main/java/net/md_5/bungee/packet/Packet9Respawn.java @@ -33,4 +33,10 @@ public class Packet9Respawn extends DefinedPacket this.worldHeight = readShort(); this.levelType = readUTF(); } + + @Override + public void handle(PacketHandler handler) throws Exception + { + handler.handle( this ); + } } diff --git a/proxy/src/main/java/net/md_5/bungee/packet/PacketC9PlayerListItem.java b/proxy/src/main/java/net/md_5/bungee/packet/PacketC9PlayerListItem.java index 01f0f42a..2ec61aa0 100644 --- a/proxy/src/main/java/net/md_5/bungee/packet/PacketC9PlayerListItem.java +++ b/proxy/src/main/java/net/md_5/bungee/packet/PacketC9PlayerListItem.java @@ -27,4 +27,10 @@ public class PacketC9PlayerListItem extends DefinedPacket writeBoolean( online ); writeShort( ping ); } + + @Override + public void handle(PacketHandler handler) throws Exception + { + handler.handle( this ); + } } diff --git a/proxy/src/main/java/net/md_5/bungee/packet/PacketFFKick.java b/proxy/src/main/java/net/md_5/bungee/packet/PacketFFKick.java index 4a5902e1..d6d0f584 100644 --- a/proxy/src/main/java/net/md_5/bungee/packet/PacketFFKick.java +++ b/proxy/src/main/java/net/md_5/bungee/packet/PacketFFKick.java @@ -21,4 +21,10 @@ public class PacketFFKick extends DefinedPacket super( 0xFF, buf ); this.message = readUTF(); } + + @Override + public void handle(PacketHandler handler) throws Exception + { + handler.handle( this ); + } } diff --git a/proxy/src/main/java/net/md_5/bungee/packet/PacketHandler.java b/proxy/src/main/java/net/md_5/bungee/packet/PacketHandler.java index 57920292..04184256 100644 --- a/proxy/src/main/java/net/md_5/bungee/packet/PacketHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/packet/PacketHandler.java @@ -3,36 +3,68 @@ package net.md_5.bungee.packet; public abstract class PacketHandler { - public void handle(DefinedPacket packet) throws Exception + private void nop(DefinedPacket packet) { throw new UnsupportedOperationException( "No handler defined for packet " + packet.getClass() ); } + public void handle(Packet0KeepAlive alive) throws Exception + { + nop( alive ); + } + public void handle(Packet1Login login) throws Exception { + nop( login ); } public void handle(Packet2Handshake handshake) throws Exception { + nop( handshake ); + } + + public void handle(Packet3Chat chat) throws Exception + { + nop( chat ); + } + + public void handle(Packet9Respawn respawn) throws Exception + { + nop( respawn ); + } + + public void handle(PacketC9PlayerListItem playerList) throws Exception + { + nop( playerList ); } public void handle(PacketCDClientStatus clientStatus) throws Exception { + nop( clientStatus ); } public void handle(PacketFAPluginMessage pluginMessage) throws Exception { + nop( pluginMessage ); } public void handle(PacketFCEncryptionResponse encryptResponse) throws Exception { + nop( encryptResponse ); } public void handle(PacketFDEncryptionRequest encryptRequest) throws Exception { + nop( encryptRequest ); } public void handle(PacketFEPing ping) throws Exception { + nop( ping ); + } + + public void handle(PacketFFKick kick) throws Exception + { + nop( kick ); } } diff --git a/proxy/src/main/java/net/md_5/bungee/packet/PacketStream.java b/proxy/src/main/java/net/md_5/bungee/packet/PacketStream.java index c8b9c416..70b43bbb 100644 --- a/proxy/src/main/java/net/md_5/bungee/packet/PacketStream.java +++ b/proxy/src/main/java/net/md_5/bungee/packet/PacketStream.java @@ -7,7 +7,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import lombok.Getter; -import lombok.Setter; import net.md_5.mendax.datainput.DataInputPacketReader; /**