From c97f1134973d6af8193c898c2f4b7cc11e7188e1 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 23 Mar 2013 20:32:37 +1100 Subject: [PATCH] Add team packet. --- .../net/md_5/bungee/packet/DefinedPacket.java | 1 + .../net/md_5/bungee/packet/PacketD1Team.java | 50 +++++++++++++++++++ .../net/md_5/bungee/packet/PacketHandler.java | 4 ++ 3 files changed, 55 insertions(+) create mode 100644 proxy/src/main/java/net/md_5/bungee/packet/PacketD1Team.java 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 6f0323608..4a3c4c772 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 @@ -229,6 +229,7 @@ public abstract class DefinedPacket implements DataOutput classes[0xCE] = PacketCEScoreboardObjective.class; classes[0xCF] = PacketCFScoreboardScore.class; classes[0xD0] = PacketD0DisplayScoreboard.class; + classes[0xD1] = PacketD1Team.class; classes[0xFA] = PacketFAPluginMessage.class; classes[0xFC] = PacketFCEncryptionResponse.class; classes[0xFD] = PacketFDEncryptionRequest.class; diff --git a/proxy/src/main/java/net/md_5/bungee/packet/PacketD1Team.java b/proxy/src/main/java/net/md_5/bungee/packet/PacketD1Team.java new file mode 100644 index 000000000..1417f9f95 --- /dev/null +++ b/proxy/src/main/java/net/md_5/bungee/packet/PacketD1Team.java @@ -0,0 +1,50 @@ +package net.md_5.bungee.packet; + +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@ToString +@EqualsAndHashCode(callSuper = false) +public class PacketD1Team extends DefinedPacket +{ + + public String name; + /** + * 0 - create, 1 remove, 2 info update, 3 player add, 4 player remove. + */ + public byte mode; + public String displayName; + public String prefix; + public String suffix; + public byte friendlyFire; + public short playerCount; + public String[] players; + + public PacketD1Team(byte[] buf) + { + super( 0xD1, buf ); + name = readUTF(); + mode = readByte(); + if ( mode == 0 || mode == 2 ) + { + displayName = readUTF(); + prefix = readUTF(); + suffix = readUTF(); + friendlyFire = readByte(); + } + if ( mode == 0 || mode == 3 || mode == 4 ) + { + players = new String[ readShort() ]; + for ( int i = 0; i < players.length; i++ ) + { + players[i] = 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 81f965a7e..1e0a543ef 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 @@ -68,6 +68,10 @@ public abstract class PacketHandler { } + public void handle(PacketD1Team team) throws Exception + { + } + public void handle(PacketFAPluginMessage pluginMessage) throws Exception { }