diff --git a/MinecraftClient/McTcpClient.cs b/MinecraftClient/McTcpClient.cs index ccb04f71..fed884a1 100644 --- a/MinecraftClient/McTcpClient.cs +++ b/MinecraftClient/McTcpClient.cs @@ -120,9 +120,6 @@ namespace MinecraftClient { if (handler.Login()) { - if (!String.IsNullOrWhiteSpace(Settings.BrandInfo)) - handler.SendBrandInfo(Settings.BrandInfo.Trim()); - if (singlecommand) { handler.SendChatMessage(command); @@ -322,6 +319,16 @@ namespace MinecraftClient client.Close(); } + /// + /// Called when a server was successfully joined + /// + + public void OnGameJoined() + { + if (!String.IsNullOrWhiteSpace(Settings.BrandInfo)) + handler.SendBrandInfo(Settings.BrandInfo.Trim()); + } + /// /// Received some text from the server /// diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index f728c470..8fac698e 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -139,6 +139,9 @@ namespace MinecraftClient.Protocol.Handlers case 0x00: //Keep-Alive SendPacket(0x00, packetData); break; + case 0x01: //Join game + handler.OnGameJoined(); + break; case 0x02: //Chat message string message = readNextString(ref packetData); try diff --git a/MinecraftClient/Protocol/IMinecraftComHandler.cs b/MinecraftClient/Protocol/IMinecraftComHandler.cs index 79f8659e..606e80ea 100644 --- a/MinecraftClient/Protocol/IMinecraftComHandler.cs +++ b/MinecraftClient/Protocol/IMinecraftComHandler.cs @@ -23,6 +23,12 @@ namespace MinecraftClient.Protocol string GetSessionID(); string[] GetOnlinePlayers(); + /// + /// Called when a server was successfully joined + /// + + void OnGameJoined(); + /// /// This method is called when the protocol handler receives a chat message ///