mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Delay BrandInfo sending
Implement Game Join event and send Brand Info only when server acknowledged game join, as ZizzyDizzyMC did before, else server may generate an invalid packet error because it was still in "login" mode and not in "playing" mode. Fix second issue in #95
This commit is contained in:
parent
8bd130eb3a
commit
b25a665c82
3 changed files with 19 additions and 3 deletions
|
|
@ -120,9 +120,6 @@ namespace MinecraftClient
|
||||||
{
|
{
|
||||||
if (handler.Login())
|
if (handler.Login())
|
||||||
{
|
{
|
||||||
if (!String.IsNullOrWhiteSpace(Settings.BrandInfo))
|
|
||||||
handler.SendBrandInfo(Settings.BrandInfo.Trim());
|
|
||||||
|
|
||||||
if (singlecommand)
|
if (singlecommand)
|
||||||
{
|
{
|
||||||
handler.SendChatMessage(command);
|
handler.SendChatMessage(command);
|
||||||
|
|
@ -322,6 +319,16 @@ namespace MinecraftClient
|
||||||
client.Close();
|
client.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when a server was successfully joined
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public void OnGameJoined()
|
||||||
|
{
|
||||||
|
if (!String.IsNullOrWhiteSpace(Settings.BrandInfo))
|
||||||
|
handler.SendBrandInfo(Settings.BrandInfo.Trim());
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Received some text from the server
|
/// Received some text from the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -139,6 +139,9 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
case 0x00: //Keep-Alive
|
case 0x00: //Keep-Alive
|
||||||
SendPacket(0x00, packetData);
|
SendPacket(0x00, packetData);
|
||||||
break;
|
break;
|
||||||
|
case 0x01: //Join game
|
||||||
|
handler.OnGameJoined();
|
||||||
|
break;
|
||||||
case 0x02: //Chat message
|
case 0x02: //Chat message
|
||||||
string message = readNextString(ref packetData);
|
string message = readNextString(ref packetData);
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,12 @@ namespace MinecraftClient.Protocol
|
||||||
string GetSessionID();
|
string GetSessionID();
|
||||||
string[] GetOnlinePlayers();
|
string[] GetOnlinePlayers();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when a server was successfully joined
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
void OnGameJoined();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method is called when the protocol handler receives a chat message
|
/// This method is called when the protocol handler receives a chat message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue