From 7be929bb089bad2446e51c715128fa6f656b5ab2 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 11 Oct 2013 19:26:40 +1100 Subject: [PATCH] Update protocol - major overhaul --- .../protocol/AbstractPacketHandler.java | 83 +++++++------- .../net/md_5/bungee/protocol/Protocol.java | 108 +++++++++++++++--- .../bungee/protocol/game/GameProtocol.java | 16 --- .../protocol/handshake/HandshakeProtocol.java | 17 --- .../bungee/protocol/login/LoginProtocol.java | 17 --- .../Packet2Chat.java => packet/Chat.java} | 4 +- .../ClientSettings.java} | 4 +- .../ClientStatus.java} | 4 +- .../EncryptionResponse.java} | 4 +- .../Handshake.java} | 4 +- .../KeepAlive.java} | 4 +- .../Packet0Kick.java => packet/Kick.java} | 6 +- .../Packet1Login.java => packet/Login.java} | 6 +- .../LoginRequest.java} | 16 ++- .../LoginSuccess.java} | 4 +- .../PlayerListItem.java} | 4 +- .../PluginMessage.java} | 4 +- .../Respawn.java} | 4 +- .../ScoreboardDisplay.java} | 4 +- .../ScoreboardObjective.java} | 4 +- .../ScoreboardScore.java} | 4 +- .../TabComplete.java} | 6 +- .../Packet41Team.java => packet/Team.java} | 6 +- .../bungee/protocol/ping/PingProtocol.java | 16 --- .../main/java/net/md_5/bungee/BungeeCord.java | 10 +- .../net/md_5/bungee/BungeeServerInfo.java | 4 +- .../java/net/md_5/bungee/EncryptionUtil.java | 4 +- .../java/net/md_5/bungee/PacketConstants.java | 16 +-- .../net/md_5/bungee/ServerConnection.java | 8 +- .../java/net/md_5/bungee/ServerConnector.java | 44 +++---- .../java/net/md_5/bungee/UserConnection.java | 18 +-- .../bungee/connection/DownstreamBridge.java | 32 +++--- .../bungee/connection/InitialHandler.java | 28 ++--- .../md_5/bungee/connection/PingHandler.java | 4 +- .../bungee/connection/UpstreamBridge.java | 22 ++-- .../main/java/net/md_5/bungee/tab/Custom.java | 6 +- .../main/java/net/md_5/bungee/tab/Global.java | 10 +- .../java/net/md_5/bungee/tab/GlobalPing.java | 4 +- .../net/md_5/bungee/tab/ServerUnique.java | 4 +- 39 files changed, 285 insertions(+), 278 deletions(-) delete mode 100644 protocol/src/main/java/net/md_5/bungee/protocol/game/GameProtocol.java delete mode 100644 protocol/src/main/java/net/md_5/bungee/protocol/handshake/HandshakeProtocol.java delete mode 100644 protocol/src/main/java/net/md_5/bungee/protocol/login/LoginProtocol.java rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet2Chat.java => packet/Chat.java} (89%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet15Settings.java => packet/ClientSettings.java} (93%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet16ClientStatus.java => packet/ClientStatus.java} (87%) rename protocol/src/main/java/net/md_5/bungee/protocol/{login/Packet1EncryptionResponse.java => packet/EncryptionResponse.java} (89%) rename protocol/src/main/java/net/md_5/bungee/protocol/{handshake/Packet0Handshake.java => packet/Handshake.java} (91%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet0KeepAlive.java => packet/KeepAlive.java} (84%) rename protocol/src/main/java/net/md_5/bungee/protocol/{login/Packet0Kick.java => packet/Kick.java} (88%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet1Login.java => packet/Login.java} (90%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet43Kick.java => packet/LoginRequest.java} (67%) rename protocol/src/main/java/net/md_5/bungee/protocol/{login/Packet2LoginSuccess.java => packet/LoginSuccess.java} (87%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet3BPlayerListItem.java => packet/PlayerListItem.java} (90%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet42PluginMessage.java => packet/PluginMessage.java} (92%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet7Respawn.java => packet/Respawn.java} (92%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet40DisplayScoreboard.java => packet/ScoreboardDisplay.java} (89%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet3EScoreboardObjective.java => packet/ScoreboardObjective.java} (90%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet3FScoreboardScore.java => packet/ScoreboardScore.java} (92%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet3DTabComplete.java => packet/TabComplete.java} (86%) rename protocol/src/main/java/net/md_5/bungee/protocol/{game/Packet41Team.java => packet/Team.java} (94%) delete mode 100644 protocol/src/main/java/net/md_5/bungee/protocol/ping/PingProtocol.java diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java index d9fd51ff4..5ee2fd17a 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/AbstractPacketHandler.java @@ -1,95 +1,96 @@ package net.md_5.bungee.protocol; -import net.md_5.bungee.protocol.handshake.Packet0Handshake; -import net.md_5.bungee.protocol.login.Packet0Kick; -import net.md_5.bungee.protocol.login.Packet1EncryptionResponse; -import net.md_5.bungee.protocol.login.Packet2LoginSuccess; +import net.md_5.bungee.protocol.packet.KeepAlive; +import net.md_5.bungee.protocol.packet.ClientSettings; +import net.md_5.bungee.protocol.packet.ClientStatus; +import net.md_5.bungee.protocol.packet.Login; +import net.md_5.bungee.protocol.packet.Chat; +import net.md_5.bungee.protocol.packet.PlayerListItem; +import net.md_5.bungee.protocol.packet.TabComplete; +import net.md_5.bungee.protocol.packet.ScoreboardObjective; +import net.md_5.bungee.protocol.packet.ScoreboardScore; +import net.md_5.bungee.protocol.packet.ScoreboardDisplay; +import net.md_5.bungee.protocol.packet.Team; +import net.md_5.bungee.protocol.packet.PluginMessage; +import net.md_5.bungee.protocol.packet.Kick; +import net.md_5.bungee.protocol.packet.Respawn; +import net.md_5.bungee.protocol.packet.Handshake; +import net.md_5.bungee.protocol.packet.EncryptionResponse; +import net.md_5.bungee.protocol.packet.LoginRequest; +import net.md_5.bungee.protocol.packet.LoginSuccess; public abstract class AbstractPacketHandler { - /*========================================================================*/ - // Handshake Start - public void handle(Packet0Handshake handshake) throws Exception - { - } - // Handshake End - /*========================================================================*/ - // Game Start - - public void handle(Packet0Handshake handshake) throws Exception + public void handle(Handshake handshake) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(KeepAlive keepAlive) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(Login login) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(Chat chat) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(Respawn respawn) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(LoginRequest loginRequest) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(ClientSettings settings) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(ClientStatus clientStatus) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(PlayerListItem playerListItem) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(TabComplete tabComplete) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(ScoreboardObjective scoreboardObjective) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(ScoreboardScore scoreboardScore) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception + public void handle(ScoreboardDisplay displayScoreboard) throws Exception { } - public void handle(Packet0Handshake handshake) throws Exception - { - } - // Game End - /*========================================================================*/ - // Ping Start - // Ping End - /*========================================================================*/ - // Login Start - - public void handle(Packet0Kick kick) throws Exception + public void handle(Team team) throws Exception { } - public void handle(Packet1EncryptionResponse encryptionResponse) throws Exception + public void handle(PluginMessage pluginMessage) throws Exception { } - public void handle(Packet2LoginSuccess loginSuccess) throws Exception + public void handle(Kick kick) throws Exception + { + } + + public void handle(EncryptionResponse encryptionResponse) throws Exception + { + } + + public void handle(LoginSuccess loginSuccess) throws Exception { } - // Login End - /*========================================================================*/ } diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java index fe088e145..d9f28385a 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/Protocol.java @@ -3,34 +3,104 @@ package net.md_5.bungee.protocol; import gnu.trove.map.TObjectIntMap; import gnu.trove.map.hash.TObjectIntHashMap; import java.lang.reflect.Constructor; -import net.md_5.bungee.protocol.handshake.HandshakeProtocol; +import net.md_5.bungee.protocol.packet.Chat; +import net.md_5.bungee.protocol.packet.ClientSettings; +import net.md_5.bungee.protocol.packet.EncryptionResponse; +import net.md_5.bungee.protocol.packet.Handshake; +import net.md_5.bungee.protocol.packet.KeepAlive; +import net.md_5.bungee.protocol.packet.Kick; +import net.md_5.bungee.protocol.packet.Login; +import net.md_5.bungee.protocol.packet.LoginRequest; +import net.md_5.bungee.protocol.packet.LoginSuccess; +import net.md_5.bungee.protocol.packet.PlayerListItem; +import net.md_5.bungee.protocol.packet.PluginMessage; +import net.md_5.bungee.protocol.packet.Respawn; +import net.md_5.bungee.protocol.packet.ScoreboardDisplay; +import net.md_5.bungee.protocol.packet.ScoreboardObjective; +import net.md_5.bungee.protocol.packet.ScoreboardScore; +import net.md_5.bungee.protocol.packet.TabComplete; +import net.md_5.bungee.protocol.packet.Team; -public class Protocol +public enum Protocol { - private static final int MAX_PACKET_ID = 0xFF; - private static final int MAX_PROTOCOLS = 0xF; + // Undef + SERVER_HANDSHAKE + { + + { + registerPacket( 0x00, Handshake.class ); + } + }, + // 0 + CLIENT_GAME + { + + { + registerPacket( 0x00, KeepAlive.class ); + registerPacket( 0x01, Login.class ); + registerPacket( 0x02, Chat.class ); + registerPacket( 0x07, Respawn.class ); + registerPacket( 0x3B, PlayerListItem.class ); + registerPacket( 0x3D, TabComplete.class ); + registerPacket( 0x3E, ScoreboardObjective.class ); + registerPacket( 0x3F, ScoreboardScore.class ); + registerPacket( 0x40, ScoreboardDisplay.class ); + registerPacket( 0x41, Team.class ); + registerPacket( 0x42, PluginMessage.class ); + registerPacket( 0x43, Kick.class ); + } + }, + // 0 + SERVER_GAME + { + + { + registerPacket( 0x00, KeepAlive.class ); + registerPacket( 0x14, TabComplete.class ); + registerPacket( 0x15, ClientSettings.class ); + registerPacket( 0x17, PluginMessage.class ); + } + }, + // 1 + CLIENT_STATUS + { + + { + } + }, + // 1 + SERVER_STATUS + { + + { + } + }, + // 2 + CLIENT_LOGIN + { + + { + registerPacket( 0x00, Kick.class ); + registerPacket( 0x01, EncryptionResponse.class ); + registerPacket( 0x02, LoginSuccess.class ); + } + }, + // 2 + SERVER_LOGIN + { + + { + registerPacket( 0x00, LoginRequest.class ); + } + }; /*========================================================================*/ - private static final Protocol[] protocols = new Protocol[ MAX_PROTOCOLS ]; + public static final int MAX_PACKET_ID = 0xFF; /*========================================================================*/ private final TObjectIntMap> packetMap = new TObjectIntHashMap<>( MAX_PACKET_ID ); private final Class[] packetClasses = new Class[ MAX_PACKET_ID ]; private final Constructor[] packetConstructors = new Constructor[ MAX_PACKET_ID ]; - static - { - - } - - public Protocol(int protocolId) - { - } - - public static Protocol getProtocol(int id) - { - return protocols[id]; - } - public final DefinedPacket createPacket(int id) { if ( id > MAX_PACKET_ID ) diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/GameProtocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/game/GameProtocol.java deleted file mode 100644 index 8ee686425..000000000 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/GameProtocol.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.md_5.bungee.protocol.game; - -import lombok.Getter; -import net.md_5.bungee.protocol.Protocol; - -public class GameProtocol extends Protocol -{ - - @Getter - private static final GameProtocol instance = new GameProtocol(); - - private GameProtocol() - { - super( 0 ); - } -} diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/handshake/HandshakeProtocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/handshake/HandshakeProtocol.java deleted file mode 100644 index 938779847..000000000 --- a/protocol/src/main/java/net/md_5/bungee/protocol/handshake/HandshakeProtocol.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.md_5.bungee.protocol.handshake; - -import lombok.Getter; -import net.md_5.bungee.protocol.Protocol; - -public class HandshakeProtocol extends Protocol -{ - - @Getter - private static final HandshakeProtocol instance = new HandshakeProtocol(); - - private HandshakeProtocol() - { - super( 0xF ); - registerPacket( 0, Packet0Handshake.class ); - } -} diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/login/LoginProtocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/login/LoginProtocol.java deleted file mode 100644 index 59794e5d7..000000000 --- a/protocol/src/main/java/net/md_5/bungee/protocol/login/LoginProtocol.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.md_5.bungee.protocol.login; - -import net.md_5.bungee.protocol.ping.*; -import lombok.Getter; -import net.md_5.bungee.protocol.Protocol; - -public class LoginProtocol extends Protocol -{ - - @Getter - private static final LoginProtocol instance = new LoginProtocol(); - - private LoginProtocol() - { - super( 2 ); - } -} diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet2Chat.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java similarity index 89% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet2Chat.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java index 152ee3015..40e92d683 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet2Chat.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Chat.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet2Chat extends DefinedPacket +public class Chat extends DefinedPacket { private String message; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet15Settings.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java similarity index 93% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet15Settings.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java index ba8526478..e3078ba0d 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet15Settings.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientSettings.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet15Settings extends DefinedPacket +public class ClientSettings extends DefinedPacket { private String locale; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet16ClientStatus.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientStatus.java similarity index 87% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet16ClientStatus.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientStatus.java index ce71376f9..d4314dc57 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet16ClientStatus.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ClientStatus.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet16ClientStatus extends DefinedPacket +public class ClientStatus extends DefinedPacket { private byte payload; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/login/Packet1EncryptionResponse.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionResponse.java similarity index 89% rename from protocol/src/main/java/net/md_5/bungee/protocol/login/Packet1EncryptionResponse.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionResponse.java index 3f23a4dac..443c7a5b8 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/login/Packet1EncryptionResponse.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/EncryptionResponse.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.login; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet1EncryptionResponse extends DefinedPacket +public class EncryptionResponse extends DefinedPacket { private byte[] sharedSecret; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/handshake/Packet0Handshake.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Handshake.java similarity index 91% rename from protocol/src/main/java/net/md_5/bungee/protocol/handshake/Packet0Handshake.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/Handshake.java index 8a9a324e9..47d122996 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/handshake/Packet0Handshake.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Handshake.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.handshake; +package net.md_5.bungee.protocol.packet; import io.netty.buffer.ByteBuf; import lombok.AllArgsConstructor; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet0Handshake extends DefinedPacket +public class Handshake extends DefinedPacket { private int protocolVersion; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet0KeepAlive.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/KeepAlive.java similarity index 84% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet0KeepAlive.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/KeepAlive.java index d7a1adee4..12065ac40 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet0KeepAlive.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/KeepAlive.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet0KeepAlive extends DefinedPacket +public class KeepAlive extends DefinedPacket { private int randomId; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/login/Packet0Kick.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Kick.java similarity index 88% rename from protocol/src/main/java/net/md_5/bungee/protocol/login/Packet0Kick.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/Kick.java index 0d18e2b2f..05ae1ae05 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/login/Packet0Kick.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Kick.java @@ -1,18 +1,18 @@ -package net.md_5.bungee.protocol.login; +package net.md_5.bungee.protocol.packet; +import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; -import net.md_5.bungee.protocol.DefinedPacket; import net.md_5.bungee.protocol.AbstractPacketHandler; @Data @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet0Kick extends DefinedPacket +public class Kick extends DefinedPacket { private String message; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet1Login.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Login.java similarity index 90% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet1Login.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/Login.java index 3ce6a5468..65510da6d 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet1Login.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Login.java @@ -1,20 +1,18 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; -import lombok.Getter; import lombok.NoArgsConstructor; -import lombok.ToString; import net.md_5.bungee.protocol.AbstractPacketHandler; @Data @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet1Login extends DefinedPacket +public class Login extends DefinedPacket { private int entityId; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet43Kick.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginRequest.java similarity index 67% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet43Kick.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginRequest.java index 58a40a440..32ba098cc 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet43Kick.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginRequest.java @@ -1,32 +1,36 @@ -package net.md_5.bungee.protocol.game; +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package net.md_5.bungee.protocol.packet; -import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; import lombok.AllArgsConstructor; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import net.md_5.bungee.protocol.AbstractPacketHandler; +import net.md_5.bungee.protocol.DefinedPacket; @Data @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet43Kick extends DefinedPacket +public class LoginRequest extends DefinedPacket { - private String message; + private String data; @Override public void read(ByteBuf buf) { - message = readString( buf ); + data = readString( buf ); } @Override public void write(ByteBuf buf) { - writeString( message, buf ); + writeString( data, buf ); } @Override diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/login/Packet2LoginSuccess.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginSuccess.java similarity index 87% rename from protocol/src/main/java/net/md_5/bungee/protocol/login/Packet2LoginSuccess.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginSuccess.java index 7e0cb0f77..ed9e5b57c 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/login/Packet2LoginSuccess.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/LoginSuccess.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.login; +package net.md_5.bungee.protocol.packet; import io.netty.buffer.ByteBuf; import lombok.AllArgsConstructor; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet2LoginSuccess extends DefinedPacket +public class LoginSuccess extends DefinedPacket { private String data; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3BPlayerListItem.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java similarity index 90% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3BPlayerListItem.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java index e5e7d78b0..9182c1cce 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3BPlayerListItem.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PlayerListItem.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet3BPlayerListItem extends DefinedPacket +public class PlayerListItem extends DefinedPacket { private String username; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet42PluginMessage.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java similarity index 92% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet42PluginMessage.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java index 41a5210fc..57d4efeae 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet42PluginMessage.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/PluginMessage.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -17,7 +17,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet42PluginMessage extends DefinedPacket +public class PluginMessage extends DefinedPacket { private String tag; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet7Respawn.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Respawn.java similarity index 92% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet7Respawn.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/Respawn.java index 32c8ee7a3..b6e60599d 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet7Respawn.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Respawn.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -13,7 +13,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet7Respawn extends DefinedPacket +public class Respawn extends DefinedPacket { private int dimension; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet40DisplayScoreboard.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardDisplay.java similarity index 89% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet40DisplayScoreboard.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardDisplay.java index caba6d918..3a6830db1 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet40DisplayScoreboard.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardDisplay.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet40DisplayScoreboard extends DefinedPacket +public class ScoreboardDisplay extends DefinedPacket { /** diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3EScoreboardObjective.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java similarity index 90% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3EScoreboardObjective.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java index aedaeab09..e2b61e484 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3EScoreboardObjective.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardObjective.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet3EScoreboardObjective extends DefinedPacket +public class ScoreboardObjective extends DefinedPacket { private String name; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3FScoreboardScore.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardScore.java similarity index 92% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3FScoreboardScore.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardScore.java index c4a7fe120..58dfa17cb 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3FScoreboardScore.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/ScoreboardScore.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -14,7 +14,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet3FScoreboardScore extends DefinedPacket +public class ScoreboardScore extends DefinedPacket { private String itemName; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3DTabComplete.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabComplete.java similarity index 86% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3DTabComplete.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/TabComplete.java index 0474d5669..ec9ca0c44 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet3DTabComplete.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/TabComplete.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,13 +12,13 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet3DTabComplete extends DefinedPacket +public class TabComplete extends DefinedPacket { private String cursor; private String[] commands; - public Packet3DTabComplete(String[] alternatives) + public TabComplete(String[] alternatives) { commands = alternatives; } diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet41Team.java b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java similarity index 94% rename from protocol/src/main/java/net/md_5/bungee/protocol/game/Packet41Team.java rename to protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java index 50ababc18..2ecce1183 100644 --- a/protocol/src/main/java/net/md_5/bungee/protocol/game/Packet41Team.java +++ b/protocol/src/main/java/net/md_5/bungee/protocol/packet/Team.java @@ -1,4 +1,4 @@ -package net.md_5.bungee.protocol.game; +package net.md_5.bungee.protocol.packet; import net.md_5.bungee.protocol.DefinedPacket; import io.netty.buffer.ByteBuf; @@ -12,7 +12,7 @@ import net.md_5.bungee.protocol.AbstractPacketHandler; @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode(callSuper = false) -public class Packet41Team extends DefinedPacket +public class Team extends DefinedPacket { private String name; @@ -32,7 +32,7 @@ public class Packet41Team extends DefinedPacket * * @param name */ - public Packet41Team(String name) + public Team(String name) { this(); this.name = name; diff --git a/protocol/src/main/java/net/md_5/bungee/protocol/ping/PingProtocol.java b/protocol/src/main/java/net/md_5/bungee/protocol/ping/PingProtocol.java deleted file mode 100644 index 5e4b76420..000000000 --- a/protocol/src/main/java/net/md_5/bungee/protocol/ping/PingProtocol.java +++ /dev/null @@ -1,16 +0,0 @@ -package net.md_5.bungee.protocol.ping; - -import lombok.Getter; -import net.md_5.bungee.protocol.Protocol; - -public class PingProtocol extends Protocol -{ - - @Getter - private static final PingProtocol instance = new PingProtocol(); - - private PingProtocol() - { - super( 1 ); - } -} diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java index 86c046660..d04db1a29 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java @@ -58,8 +58,8 @@ import net.md_5.bungee.config.YamlConfig; import net.md_5.bungee.log.LoggingOutputStream; import net.md_5.bungee.netty.PipelineUtils; import net.md_5.bungee.protocol.DefinedPacket; -import net.md_5.bungee.protocol.game.Packet2Chat; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; +import net.md_5.bungee.protocol.packet.Chat; +import net.md_5.bungee.protocol.packet.PluginMessage; import net.md_5.bungee.protocol.Vanilla; import net.md_5.bungee.query.RemoteQuery; import net.md_5.bungee.tab.Custom; @@ -447,9 +447,9 @@ public class BungeeCord extends ProxyServer return Collections.unmodifiableCollection( pluginChannels ); } - public Packet42PluginMessage registerChannels() + public PluginMessage registerChannels() { - return new Packet42PluginMessage( "REGISTER", Util.format( pluginChannels, "\00" ).getBytes() ); + return new PluginMessage( "REGISTER", Util.format( pluginChannels, "\00" ).getBytes() ); } @Override @@ -482,7 +482,7 @@ public class BungeeCord extends ProxyServer getConsole().sendMessage( message ); // TODO: Here too String encoded = BungeeCord.getInstance().gson.toJson( message ); - broadcast( new Packet2Chat( "{\"text\":" + encoded + "}" ) ); + broadcast( new Chat( "{\"text\":" + encoded + "}" ) ); } public void addConnection(UserConnection con) diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java index bc0908a1c..48e46ed12 100644 --- a/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java +++ b/proxy/src/main/java/net/md_5/bungee/BungeeServerInfo.java @@ -26,7 +26,7 @@ import net.md_5.bungee.connection.PingHandler; import net.md_5.bungee.netty.HandlerBoss; import net.md_5.bungee.netty.PipelineUtils; import net.md_5.bungee.protocol.DefinedPacket; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; +import net.md_5.bungee.protocol.packet.PluginMessage; @RequiredArgsConstructor public class BungeeServerInfo implements ServerInfo @@ -97,7 +97,7 @@ public class BungeeServerInfo implements ServerInfo server.sendData( channel, data ); } else { - packetQueue.add( new Packet42PluginMessage( channel, data ) ); + packetQueue.add( new PluginMessage( channel, data ) ); } } } diff --git a/proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java b/proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java index 2432240e7..15a87766e 100644 --- a/proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java +++ b/proxy/src/main/java/net/md_5/bungee/EncryptionUtil.java @@ -15,7 +15,7 @@ import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import lombok.Getter; -import net.md_5.bungee.protocol.login.Packet1EncryptionResponse; +import net.md_5.bungee.protocol.packet.EncryptionResponse; import net.md_5.bungee.protocol.packet.PacketFDEncryptionRequest; /** @@ -49,7 +49,7 @@ public class EncryptionUtil return new PacketFDEncryptionRequest( hash, pubKey, verify ); } - public static SecretKey getSecret(Packet1EncryptionResponse resp, PacketFDEncryptionRequest request) throws GeneralSecurityException + public static SecretKey getSecret(EncryptionResponse resp, PacketFDEncryptionRequest request) throws GeneralSecurityException { Cipher cipher = Cipher.getInstance( "RSA" ); cipher.init( Cipher.DECRYPT_MODE, keys.getPrivate() ); diff --git a/proxy/src/main/java/net/md_5/bungee/PacketConstants.java b/proxy/src/main/java/net/md_5/bungee/PacketConstants.java index 730a24af2..b20726186 100644 --- a/proxy/src/main/java/net/md_5/bungee/PacketConstants.java +++ b/proxy/src/main/java/net/md_5/bungee/PacketConstants.java @@ -1,18 +1,18 @@ package net.md_5.bungee; -import net.md_5.bungee.protocol.game.Packet7Respawn; -import net.md_5.bungee.protocol.game.Packet16ClientStatus; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; +import net.md_5.bungee.protocol.packet.Respawn; +import net.md_5.bungee.protocol.packet.ClientStatus; +import net.md_5.bungee.protocol.packet.PluginMessage; public class PacketConstants { - public static final Packet7Respawn DIM1_SWITCH = new Packet7Respawn( (byte) 1, (byte) 0, (byte) 0, (short) 256, "DEFAULT" ); - public static final Packet7Respawn DIM2_SWITCH = new Packet7Respawn( (byte) -1, (byte) 0, (byte) 0, (short) 256, "DEFAULT" ); - public static final Packet16ClientStatus CLIENT_LOGIN = new Packet16ClientStatus( (byte) 0 ); - public static final Packet42PluginMessage FORGE_MOD_REQUEST = new Packet42PluginMessage( "FML", new byte[] + public static final Respawn DIM1_SWITCH = new Respawn( (byte) 1, (byte) 0, (byte) 0, (short) 256, "DEFAULT" ); + public static final Respawn DIM2_SWITCH = new Respawn( (byte) -1, (byte) 0, (byte) 0, (short) 256, "DEFAULT" ); + public static final ClientStatus CLIENT_LOGIN = new ClientStatus( (byte) 0 ); + public static final PluginMessage FORGE_MOD_REQUEST = new PluginMessage( "FML", new byte[] { 0, 0, 0, 0, 0, 2 } ); - public static final Packet42PluginMessage I_AM_BUNGEE = new Packet42PluginMessage( "BungeeCord", new byte[ 0 ] ); + public static final PluginMessage I_AM_BUNGEE = new PluginMessage( "BungeeCord", new byte[ 0 ] ); } diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java index 92e133d94..b5c5af500 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnection.java @@ -8,8 +8,8 @@ import lombok.Setter; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.netty.ChannelWrapper; import net.md_5.bungee.protocol.DefinedPacket; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; -import net.md_5.bungee.protocol.game.Packet43Kick; +import net.md_5.bungee.protocol.packet.PluginMessage; +import net.md_5.bungee.protocol.packet.Kick; @RequiredArgsConstructor public class ServerConnection implements Server @@ -34,7 +34,7 @@ public class ServerConnection implements Server @Override public void sendData(String channel, byte[] data) { - unsafe().sendPacket( new Packet42PluginMessage( channel, data ) ); + unsafe().sendPacket( new PluginMessage( channel, data ) ); } @Override @@ -43,7 +43,7 @@ public class ServerConnection implements Server if ( !ch.isClosed() ) { // TODO: Can we just use a future here? - unsafe().sendPacket( new Packet43Kick( reason ) ); + unsafe().sendPacket( new Kick( reason ) ); ch.getHandle().eventLoop().schedule( new Runnable() { @Override diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index f8ac88e25..42c1e83e1 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -31,14 +31,14 @@ import net.md_5.bungee.netty.PipelineUtils; import net.md_5.bungee.protocol.Forge; import net.md_5.bungee.protocol.MinecraftOutput; import net.md_5.bungee.protocol.DefinedPacket; -import net.md_5.bungee.protocol.game.Packet1Login; -import net.md_5.bungee.protocol.game.Packet7Respawn; -import net.md_5.bungee.protocol.game.Packet3EScoreboardObjective; -import net.md_5.bungee.protocol.game.Packet41Team; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; -import net.md_5.bungee.protocol.login.Packet1EncryptionResponse; +import net.md_5.bungee.protocol.packet.Login; +import net.md_5.bungee.protocol.packet.Respawn; +import net.md_5.bungee.protocol.packet.ScoreboardObjective; +import net.md_5.bungee.protocol.packet.Team; +import net.md_5.bungee.protocol.packet.PluginMessage; +import net.md_5.bungee.protocol.packet.EncryptionResponse; import net.md_5.bungee.protocol.packet.PacketFDEncryptionRequest; -import net.md_5.bungee.protocol.game.Packet43Kick; +import net.md_5.bungee.protocol.packet.Kick; import net.md_5.bungee.protocol.packet.forge.Forge1Login; @RequiredArgsConstructor @@ -81,7 +81,7 @@ public class ServerConnector extends PacketHandler out.writeUTF( "Login" ); out.writeUTF( user.getAddress().getHostString() ); out.writeInt( user.getAddress().getPort() ); - channel.write( new Packet42PluginMessage( "BungeeCord", out.toByteArray() ) ); + channel.write( new PluginMessage( "BungeeCord", out.toByteArray() ) ); channel.write( user.getPendingConnection().getHandshake() ); @@ -99,7 +99,7 @@ public class ServerConnector extends PacketHandler } @Override - public void handle(Packet1Login login) throws Exception + public void handle(Login login) throws Exception { Preconditions.checkState( thisState == State.LOGIN, "Not exepcting LOGIN" ); @@ -117,13 +117,13 @@ public class ServerConnector extends PacketHandler } } - for ( Packet42PluginMessage message : user.getPendingConnection().getRegisterMessages() ) + for ( PluginMessage message : user.getPendingConnection().getRegisterMessages() ) { ch.write( message ); } if ( !sentMessages ) { - for ( Packet42PluginMessage message : user.getPendingConnection().getLoginMessages() ) + for ( PluginMessage message : user.getPendingConnection().getLoginMessages() ) { ch.write( message ); } @@ -143,21 +143,21 @@ public class ServerConnector extends PacketHandler user.setServerEntityId( login.getEntityId() ); // Set tab list size, this sucks balls, TODO: what shall we do about packet mutability - Packet1Login modLogin; + Login modLogin; if ( ch.getHandle().pipeline().get( PacketDecoder.class ).getProtocol() == Forge.getInstance() ) { modLogin = new Forge1Login( login.getEntityId(), login.getLevelType(), login.getGameMode(), login.getDimension(), login.getDifficulty(), login.getUnused(), (byte) user.getPendingConnection().getListener().getTabListSize() ); } else { - modLogin = new Packet1Login( login.getEntityId(), login.getLevelType(), login.getGameMode(), (byte) login.getDimension(), login.getDifficulty(), login.getUnused(), + modLogin = new Login( login.getEntityId(), login.getLevelType(), login.getGameMode(), (byte) login.getDimension(), login.getDifficulty(), login.getUnused(), (byte) user.getPendingConnection().getListener().getTabListSize() ); } user.unsafe().sendPacket( modLogin ); MinecraftOutput out = new MinecraftOutput(); out.writeStringUTF8WithoutLengthHeaderBecauseDinnerboneStuffedUpTheMCBrandPacket( ProxyServer.getInstance().getName() + " (" + ProxyServer.getInstance().getVersion() + ")" ); - user.unsafe().sendPacket( new Packet42PluginMessage( "MC|Brand", out.toArray() ) ); + user.unsafe().sendPacket( new PluginMessage( "MC|Brand", out.toArray() ) ); } else { user.getTabList().onServerChange(); @@ -165,18 +165,18 @@ public class ServerConnector extends PacketHandler Scoreboard serverScoreboard = user.getServerSentScoreboard(); for ( Objective objective : serverScoreboard.getObjectives() ) { - user.unsafe().sendPacket( new Packet3EScoreboardObjective( objective.getName(), objective.getValue(), (byte) 1 ) ); + user.unsafe().sendPacket( new ScoreboardObjective( objective.getName(), objective.getValue(), (byte) 1 ) ); } for ( Team team : serverScoreboard.getTeams() ) { - user.unsafe().sendPacket( new Packet41Team( team.getName() ) ); + user.unsafe().sendPacket( new Team( team.getName() ) ); } serverScoreboard.clear(); user.sendDimensionSwitch(); user.setServerEntityId( login.getEntityId() ); - user.unsafe().sendPacket( new Packet7Respawn( login.getDimension(), login.getDifficulty(), login.getGameMode(), (short) 256, login.getLevelType() ) ); + user.unsafe().sendPacket( new Respawn( login.getDimension(), login.getDifficulty(), login.getGameMode(), (short) 256, login.getLevelType() ) ); // Remove from old servers user.getServer().setObsolete( true ); @@ -222,7 +222,7 @@ public class ServerConnector extends PacketHandler byte[] shared = EncryptionUtil.encrypt( publickey, secretkey.getEncoded() ); byte[] token = EncryptionUtil.encrypt( publickey, encryptRequest.getVerifyToken() ); - ch.write( new Packet1EncryptionResponse( shared, token ) ); + ch.write( new EncryptionResponse( shared, token ) ); Cipher encrypt = EncryptionUtil.getCipher( Cipher.ENCRYPT_MODE, secretkey ); ch.addBefore( PipelineUtils.PACKET_DECODE_HANDLER, PipelineUtils.ENCRYPT_HANDLER, new CipherEncoder( encrypt ) ); @@ -235,7 +235,7 @@ public class ServerConnector extends PacketHandler } @Override - public void handle(Packet1EncryptionResponse encryptResponse) throws Exception + public void handle(EncryptionResponse encryptResponse) throws Exception { Preconditions.checkState( thisState == State.ENCRYPT_RESPONSE, "Not expecting ENCRYPT_RESPONSE" ); @@ -249,7 +249,7 @@ public class ServerConnector extends PacketHandler } @Override - public void handle(Packet43Kick kick) throws Exception + public void handle(Kick kick) throws Exception { ServerInfo def = bungee.getServerInfo( user.getPendingConnection().getListener().getFallbackServer() ); if ( Objects.equals( target, def ) ) @@ -274,7 +274,7 @@ public class ServerConnector extends PacketHandler } @Override - public void handle(Packet42PluginMessage pluginMessage) throws Exception + public void handle(PluginMessage pluginMessage) throws Exception { if ( pluginMessage.equals( PacketConstants.I_AM_BUNGEE ) ) { @@ -299,7 +299,7 @@ public class ServerConnector extends PacketHandler user.unsafe().sendPacket( pluginMessage ); // We have to forward these to the user, especially with Forge as stuff might break if ( !sentMessages && user.getPendingConnection().getForgeLogin() != null ) { - for ( Packet42PluginMessage message : user.getPendingConnection().getLoginMessages() ) + for ( PluginMessage message : user.getPendingConnection().getLoginMessages() ) { ch.write( message ); } diff --git a/proxy/src/main/java/net/md_5/bungee/UserConnection.java b/proxy/src/main/java/net/md_5/bungee/UserConnection.java index 37779bda1..117f86c13 100644 --- a/proxy/src/main/java/net/md_5/bungee/UserConnection.java +++ b/proxy/src/main/java/net/md_5/bungee/UserConnection.java @@ -33,10 +33,10 @@ import net.md_5.bungee.netty.HandlerBoss; import net.md_5.bungee.netty.PacketWrapper; import net.md_5.bungee.netty.PipelineUtils; import net.md_5.bungee.protocol.DefinedPacket; -import net.md_5.bungee.protocol.game.Packet2Chat; -import net.md_5.bungee.protocol.game.Packet15Settings; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; -import net.md_5.bungee.protocol.game.Packet43Kick; +import net.md_5.bungee.protocol.packet.Chat; +import net.md_5.bungee.protocol.packet.ClientSettings; +import net.md_5.bungee.protocol.packet.PluginMessage; +import net.md_5.bungee.protocol.packet.Kick; import net.md_5.bungee.util.CaseInsensitiveSet; @RequiredArgsConstructor @@ -88,7 +88,7 @@ public final class UserConnection implements ProxiedPlayer private int serverEntityId; @Getter @Setter - private Packet15Settings settings; + private ClientSettings settings; @Getter private final Scoreboard serverSentScoreboard = new Scoreboard(); /*========================================================================*/ @@ -251,7 +251,7 @@ public final class UserConnection implements ProxiedPlayer if ( ch.getHandle().isActive() ) { bungee.getLogger().log( Level.INFO, "[" + getName() + "] disconnected with: " + reason ); - unsafe().sendPacket( new Packet43Kick( reason ) ); + unsafe().sendPacket( new Kick( reason ) ); ch.close(); if ( server != null ) { @@ -264,7 +264,7 @@ public final class UserConnection implements ProxiedPlayer public void chat(String message) { Preconditions.checkState( server != null, "Not connected to server" ); - server.getCh().write( new Packet2Chat( message ) ); + server.getCh().write( new Chat( message ) ); } @Override @@ -272,7 +272,7 @@ public final class UserConnection implements ProxiedPlayer { // TODO: Fix this String encoded = BungeeCord.getInstance().gson.toJson( message ); - unsafe().sendPacket( new Packet2Chat( "{\"text\":" + encoded + "}" ) ); + unsafe().sendPacket( new Chat( "{\"text\":" + encoded + "}" ) ); } @Override @@ -287,7 +287,7 @@ public final class UserConnection implements ProxiedPlayer @Override public void sendData(String channel, byte[] data) { - unsafe().sendPacket( new Packet42PluginMessage( channel, data ) ); + unsafe().sendPacket( new PluginMessage( channel, data ) ); } @Override diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index 42ffb09b2..e6da72e3b 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -22,14 +22,14 @@ import net.md_5.bungee.api.score.Team; import net.md_5.bungee.netty.ChannelWrapper; import net.md_5.bungee.netty.PacketHandler; import net.md_5.bungee.netty.PacketWrapper; -import net.md_5.bungee.protocol.game.Packet0KeepAlive; -import net.md_5.bungee.protocol.game.Packet3BPlayerListItem; -import net.md_5.bungee.protocol.game.Packet3EScoreboardObjective; -import net.md_5.bungee.protocol.game.Packet3FScoreboardScore; -import net.md_5.bungee.protocol.game.Packet40DisplayScoreboard; -import net.md_5.bungee.protocol.game.Packet41Team; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; -import net.md_5.bungee.protocol.game.Packet43Kick; +import net.md_5.bungee.protocol.packet.KeepAlive; +import net.md_5.bungee.protocol.packet.PlayerListItem; +import net.md_5.bungee.protocol.packet.ScoreboardObjective; +import net.md_5.bungee.protocol.packet.ScoreboardScore; +import net.md_5.bungee.protocol.packet.ScoreboardDisplay; +import net.md_5.bungee.protocol.packet.Team; +import net.md_5.bungee.protocol.packet.PluginMessage; +import net.md_5.bungee.protocol.packet.Kick; @RequiredArgsConstructor public class DownstreamBridge extends PacketHandler @@ -81,14 +81,14 @@ public class DownstreamBridge extends PacketHandler } @Override - public void handle(Packet0KeepAlive alive) throws Exception + public void handle(KeepAlive alive) throws Exception { con.setSentPingId( alive.getRandomId() ); con.setSentPingTime( System.currentTimeMillis() ); } @Override - public void handle(Packet3BPlayerListItem playerList) throws Exception + public void handle(PlayerListItem playerList) throws Exception { if ( !con.getTabList().onListUpdate( playerList.getUsername(), playerList.isOnline(), playerList.getPing() ) ) @@ -98,7 +98,7 @@ public class DownstreamBridge extends PacketHandler } @Override - public void handle(Packet3EScoreboardObjective objective) throws Exception + public void handle(ScoreboardObjective objective) throws Exception { Scoreboard serverScoreboard = con.getServerSentScoreboard(); switch ( objective.getAction() ) @@ -113,7 +113,7 @@ public class DownstreamBridge extends PacketHandler } @Override - public void handle(Packet3FScoreboardScore score) throws Exception + public void handle(ScoreboardScore score) throws Exception { Scoreboard serverScoreboard = con.getServerSentScoreboard(); switch ( score.getAction() ) @@ -130,7 +130,7 @@ public class DownstreamBridge extends PacketHandler } @Override - public void handle(Packet40DisplayScoreboard displayScoreboard) throws Exception + public void handle(ScoreboardDisplay displayScoreboard) throws Exception { Scoreboard serverScoreboard = con.getServerSentScoreboard(); serverScoreboard.setName( displayScoreboard.getName() ); @@ -138,7 +138,7 @@ public class DownstreamBridge extends PacketHandler } @Override - public void handle(Packet41Team team) throws Exception + public void handle(Team team) throws Exception { Scoreboard serverScoreboard = con.getServerSentScoreboard(); // Remove team and move on @@ -185,7 +185,7 @@ public class DownstreamBridge extends PacketHandler } @Override - public void handle(Packet42PluginMessage pluginMessage) throws Exception + public void handle(PluginMessage pluginMessage) throws Exception { DataInput in = pluginMessage.getStream(); PluginMessageEvent event = new PluginMessageEvent( con.getServer(), con, pluginMessage.getTag(), pluginMessage.getData().clone() ); @@ -330,7 +330,7 @@ public class DownstreamBridge extends PacketHandler } @Override - public void handle(Packet43Kick kick) throws Exception + public void handle(Kick kick) throws Exception { ServerInfo def = bungee.getServerInfo( con.getPendingConnection().getListener().getFallbackServer() ); if ( Objects.equals( server.getInfo(), def ) ) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index ef793f67e..c150b090d 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -45,14 +45,14 @@ import net.md_5.bungee.protocol.Forge; import net.md_5.bungee.protocol.MinecraftInput; import net.md_5.bungee.protocol.Vanilla; import net.md_5.bungee.protocol.DefinedPacket; -import net.md_5.bungee.protocol.game.Packet1Login; +import net.md_5.bungee.protocol.packet.Login; import net.md_5.bungee.protocol.packet.Packet2Handshake; -import net.md_5.bungee.protocol.game.Packet16ClientStatus; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; -import net.md_5.bungee.protocol.login.Packet1EncryptionResponse; +import net.md_5.bungee.protocol.packet.ClientStatus; +import net.md_5.bungee.protocol.packet.PluginMessage; +import net.md_5.bungee.protocol.packet.EncryptionResponse; import net.md_5.bungee.protocol.packet.PacketFDEncryptionRequest; import net.md_5.bungee.protocol.packet.PacketFEPing; -import net.md_5.bungee.protocol.game.Packet43Kick; +import net.md_5.bungee.protocol.packet.Kick; import net.md_5.bungee.api.AbstractReconnectHandler; import net.md_5.bungee.api.event.PlayerHandshakeEvent; @@ -65,14 +65,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection @Getter private final ListenerInfo listener; @Getter - private Packet1Login forgeLogin; + private Login forgeLogin; @Getter private Packet2Handshake handshake; private PacketFDEncryptionRequest request; @Getter - private List loginMessages = new ArrayList<>(); + private List loginMessages = new ArrayList<>(); @Getter - private List registerMessages = new ArrayList<>(); + private List registerMessages = new ArrayList<>(); private State thisState = State.HANDSHAKE; private SecretKey sharedKey; private final Unsafe unsafe = new Unsafe() @@ -110,7 +110,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection } @Override - public void handle(Packet42PluginMessage pluginMessage) throws Exception + public void handle(PluginMessage pluginMessage) throws Exception { if ( pluginMessage.getTag().equals( "MC|PingHost" ) ) { @@ -188,7 +188,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection } @Override - public void handle(Packet1Login login) throws Exception + public void handle(Login login) throws Exception { Preconditions.checkState( thisState == State.LOGIN, "Not expecting FORGE LOGIN" ); Preconditions.checkState( forgeLogin == null, "Already received FORGE LOGIN" ); @@ -243,7 +243,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection } @Override - public void handle(final Packet1EncryptionResponse encryptResponse) throws Exception + public void handle(final EncryptionResponse encryptResponse) throws Exception { Preconditions.checkState( thisState == State.ENCRYPT, "Not expecting ENCRYPT" ); @@ -323,7 +323,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection { if ( ch.getHandle().isActive() ) { - unsafe().sendPacket( new Packet1EncryptionResponse( new byte[ 0 ], new byte[ 0 ] ) ); + unsafe().sendPacket( new EncryptionResponse( new byte[ 0 ], new byte[ 0 ] ) ); try { Cipher encrypt = EncryptionUtil.getCipher( Cipher.ENCRYPT_MODE, sharedKey ); @@ -343,7 +343,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection } @Override - public void handle(Packet16ClientStatus clientStatus) throws Exception + public void handle(ClientStatus clientStatus) throws Exception { Preconditions.checkState( thisState == State.LOGIN, "Not expecting LOGIN" ); @@ -373,7 +373,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection { if ( !ch.isClosed() ) { - unsafe().sendPacket( new Packet43Kick( reason ) ); + unsafe().sendPacket( new Kick( reason ) ); ch.close(); } } diff --git a/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java index dfca6b643..32370e2a7 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/PingHandler.java @@ -8,7 +8,7 @@ import net.md_5.bungee.api.ServerPing; import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.netty.ChannelWrapper; import net.md_5.bungee.netty.PacketHandler; -import net.md_5.bungee.protocol.game.Packet43Kick; +import net.md_5.bungee.protocol.packet.Kick; @RequiredArgsConstructor public class PingHandler extends PacketHandler @@ -34,7 +34,7 @@ public class PingHandler extends PacketHandler } @Override - public void handle(Packet43Kick kick) throws Exception + public void handle(Kick kick) throws Exception { String[] split = kick.getMessage().split( "\00" ); ServerPing ping = new ServerPing( Byte.parseByte( split[1] ), split[2], split[3], Integer.parseInt( split[4] ), Integer.parseInt( split[5] ) ); diff --git a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java index 8648d0e69..eae122585 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/UpstreamBridge.java @@ -11,11 +11,11 @@ import net.md_5.bungee.api.event.PluginMessageEvent; import net.md_5.bungee.netty.ChannelWrapper; import net.md_5.bungee.netty.PacketHandler; import net.md_5.bungee.netty.PacketWrapper; -import net.md_5.bungee.protocol.game.Packet0KeepAlive; -import net.md_5.bungee.protocol.game.Packet2Chat; -import net.md_5.bungee.protocol.game.Packet3DTabComplete; -import net.md_5.bungee.protocol.game.Packet15Settings; -import net.md_5.bungee.protocol.game.Packet42PluginMessage; +import net.md_5.bungee.protocol.packet.KeepAlive; +import net.md_5.bungee.protocol.packet.Chat; +import net.md_5.bungee.protocol.packet.TabComplete; +import net.md_5.bungee.protocol.packet.ClientSettings; +import net.md_5.bungee.protocol.packet.PluginMessage; import java.util.ArrayList; import java.util.List; @@ -67,7 +67,7 @@ public class UpstreamBridge extends PacketHandler } @Override - public void handle(Packet0KeepAlive alive) throws Exception + public void handle(KeepAlive alive) throws Exception { if ( alive.getRandomId() == con.getSentPingId() ) { @@ -78,7 +78,7 @@ public class UpstreamBridge extends PacketHandler } @Override - public void handle(Packet2Chat chat) throws Exception + public void handle(Chat chat) throws Exception { ChatEvent chatEvent = new ChatEvent( con, con.getServer(), chat.getMessage() ); if ( !bungee.getPluginManager().callEvent( chatEvent ).isCancelled() ) @@ -93,7 +93,7 @@ public class UpstreamBridge extends PacketHandler } @Override - public void handle(Packet3DTabComplete tabComplete) throws Exception + public void handle(TabComplete tabComplete) throws Exception { if ( tabComplete.getCursor().startsWith( "/" ) ) { @@ -102,20 +102,20 @@ public class UpstreamBridge extends PacketHandler if ( !results.isEmpty() ) { - con.unsafe().sendPacket( new Packet3DTabComplete( results.toArray( new String[ results.size() ] ) ) ); + con.unsafe().sendPacket( new TabComplete( results.toArray( new String[ results.size() ] ) ) ); throw new CancelSendSignal(); } } } @Override - public void handle(Packet15Settings settings) throws Exception + public void handle(ClientSettings settings) throws Exception { con.setSettings( settings ); } @Override - public void handle(Packet42PluginMessage pluginMessage) throws Exception + public void handle(PluginMessage pluginMessage) throws Exception { if ( pluginMessage.getTag().equals( "BungeeCord" ) ) { diff --git a/proxy/src/main/java/net/md_5/bungee/tab/Custom.java b/proxy/src/main/java/net/md_5/bungee/tab/Custom.java index 86c2a0847..902d2cf6c 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/Custom.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/Custom.java @@ -7,7 +7,7 @@ import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.tab.CustomTabList; import net.md_5.bungee.api.tab.TabListAdapter; -import net.md_5.bungee.protocol.game.Packet3BPlayerListItem; +import net.md_5.bungee.protocol.packet.PlayerListItem; public class Custom extends TabListAdapter implements CustomTabList { @@ -96,7 +96,7 @@ public class Custom extends TabListAdapter implements CustomTabList { String text = ( slots[i][j] != null ) ? slots[i][j] : new StringBuilder().append( base( i ) ).append( base( j ) ).toString(); sent[i][j] = text; - getPlayer().unsafe().sendPacket( new Packet3BPlayerListItem( text, true, (short) 0 ) ); + getPlayer().unsafe().sendPacket( new PlayerListItem( text, true, (short) 0 ) ); } } } @@ -112,7 +112,7 @@ public class Custom extends TabListAdapter implements CustomTabList { String text = sent[i][j]; sent[i][j] = null; - getPlayer().unsafe().sendPacket( new Packet3BPlayerListItem( text, false, (short) 9999 ) ); + getPlayer().unsafe().sendPacket( new PlayerListItem( text, false, (short) 9999 ) ); } } } diff --git a/proxy/src/main/java/net/md_5/bungee/tab/Global.java b/proxy/src/main/java/net/md_5/bungee/tab/Global.java index 82c327a51..608513e4e 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/Global.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/Global.java @@ -4,7 +4,7 @@ import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.ProxyServer; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.tab.TabListAdapter; -import net.md_5.bungee.protocol.game.Packet3BPlayerListItem; +import net.md_5.bungee.protocol.packet.PlayerListItem; public class Global extends TabListAdapter { @@ -16,9 +16,9 @@ public class Global extends TabListAdapter { for ( ProxiedPlayer p : ProxyServer.getInstance().getPlayers() ) { - getPlayer().unsafe().sendPacket( new Packet3BPlayerListItem( p.getDisplayName(), true, (short) p.getPing() ) ); + getPlayer().unsafe().sendPacket( new PlayerListItem( p.getDisplayName(), true, (short) p.getPing() ) ); } - BungeeCord.getInstance().broadcast( new Packet3BPlayerListItem( getPlayer().getDisplayName(), true, (short) getPlayer().getPing() ) ); + BungeeCord.getInstance().broadcast( new PlayerListItem( getPlayer().getDisplayName(), true, (short) getPlayer().getPing() ) ); } @Override @@ -27,14 +27,14 @@ public class Global extends TabListAdapter if ( !sentPing ) { sentPing = true; - BungeeCord.getInstance().broadcast( new Packet3BPlayerListItem( getPlayer().getDisplayName(), true, (short) getPlayer().getPing() ) ); + BungeeCord.getInstance().broadcast( new PlayerListItem( getPlayer().getDisplayName(), true, (short) getPlayer().getPing() ) ); } } @Override public void onDisconnect() { - BungeeCord.getInstance().broadcast( new Packet3BPlayerListItem( getPlayer().getDisplayName(), false, (short) 9999 ) ); + BungeeCord.getInstance().broadcast( new PlayerListItem( getPlayer().getDisplayName(), false, (short) 9999 ) ); } @Override diff --git a/proxy/src/main/java/net/md_5/bungee/tab/GlobalPing.java b/proxy/src/main/java/net/md_5/bungee/tab/GlobalPing.java index 15633ff90..0c6a1169d 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/GlobalPing.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/GlobalPing.java @@ -2,7 +2,7 @@ package net.md_5.bungee.tab; import net.md_5.bungee.BungeeCord; import net.md_5.bungee.api.connection.ProxiedPlayer; -import net.md_5.bungee.protocol.game.Packet3BPlayerListItem; +import net.md_5.bungee.protocol.packet.PlayerListItem; public class GlobalPing extends Global { @@ -17,7 +17,7 @@ public class GlobalPing extends Global if ( ping - PING_THRESHOLD > lastPing && ping + PING_THRESHOLD < lastPing ) { lastPing = ping; - BungeeCord.getInstance().broadcast( new Packet3BPlayerListItem( getPlayer().getDisplayName(), true, (short) ping ) ); + BungeeCord.getInstance().broadcast( new PlayerListItem( getPlayer().getDisplayName(), true, (short) ping ) ); } } } diff --git a/proxy/src/main/java/net/md_5/bungee/tab/ServerUnique.java b/proxy/src/main/java/net/md_5/bungee/tab/ServerUnique.java index f2969279d..00dc20742 100644 --- a/proxy/src/main/java/net/md_5/bungee/tab/ServerUnique.java +++ b/proxy/src/main/java/net/md_5/bungee/tab/ServerUnique.java @@ -3,7 +3,7 @@ package net.md_5.bungee.tab; import java.util.Collection; import java.util.HashSet; import net.md_5.bungee.api.tab.TabListAdapter; -import net.md_5.bungee.protocol.game.Packet3BPlayerListItem; +import net.md_5.bungee.protocol.packet.PlayerListItem; public class ServerUnique extends TabListAdapter { @@ -17,7 +17,7 @@ public class ServerUnique extends TabListAdapter { for ( String username : usernames ) { - getPlayer().unsafe().sendPacket( new Packet3BPlayerListItem( username, false, (short) 9999 ) ); + getPlayer().unsafe().sendPacket( new PlayerListItem( username, false, (short) 9999 ) ); } usernames.clear(); }