diff --git a/MinecraftClient/CSharpRunner.cs b/MinecraftClient/CSharpRunner.cs
index 31873014..9b2848c3 100644
--- a/MinecraftClient/CSharpRunner.cs
+++ b/MinecraftClient/CSharpRunner.cs
@@ -237,7 +237,8 @@ namespace MinecraftClient
/// It will unload and reload all the bots and then reconnect to the server
///
/// If connection fails, the client will make X extra attempts
- new public void ReconnectToTheServer(int extraAttempts = -999999)
+ /// Optional delay, in seconds, before restarting
+ new public void ReconnectToTheServer(int extraAttempts = -999999, int delaySeconds = 0)
{
if (extraAttempts == -999999)
base.ReconnectToTheServer();
diff --git a/MinecraftClient/ChatBot.cs b/MinecraftClient/ChatBot.cs
index deca76d6..14a7079a 100644
--- a/MinecraftClient/ChatBot.cs
+++ b/MinecraftClient/ChatBot.cs
@@ -109,6 +109,16 @@ namespace MinecraftClient
/// Text from the server
public virtual void GetText(string text) { }
+ ///
+ /// Any text sent by the server will be sent here by MinecraftCom (extended variant)
+ ///
+ ///
+ /// You can use Json.ParseJson() to process the JSON string.
+ ///
+ /// Text from the server
+ /// Raw JSON from the server. This parameter will be NULL on MC 1.5 or lower!
+ public virtual void GetText(string text, string json) { }
+
///
/// Is called when the client has been disconnected fom the server
///
diff --git a/MinecraftClient/McTcpClient.cs b/MinecraftClient/McTcpClient.cs
index d7c171ad..990c4896 100644
--- a/MinecraftClient/McTcpClient.cs
+++ b/MinecraftClient/McTcpClient.cs
@@ -439,9 +439,17 @@ namespace MinecraftClient
/// Received some text from the server
///
/// Text received
+ /// TRUE if the text is JSON-Encoded
/// Links embedded in text
- public void OnTextReceived(string text, IEnumerable links)
+ public void OnTextReceived(string text, bool isJson)
{
+ List links = new List();
+ string json = null;
+ if (isJson)
+ {
+ json = text;
+ text = ChatParser.ParseText(json, links);
+ }
ConsoleIO.WriteLineFormatted(text, false);
if (Settings.DisplayChatLinks)
foreach (string link in links)
@@ -451,6 +459,7 @@ namespace MinecraftClient
try
{
bots[i].GetText(text);
+ bots[i].GetText(text, json);
}
catch (Exception e)
{
diff --git a/MinecraftClient/MinecraftClient.csproj b/MinecraftClient/MinecraftClient.csproj
index 9559f09c..79a6c584 100644
--- a/MinecraftClient/MinecraftClient.csproj
+++ b/MinecraftClient/MinecraftClient.csproj
@@ -125,6 +125,7 @@
+
@@ -208,7 +209,6 @@
-
diff --git a/MinecraftClient/Protocol/Handlers/ChatParser.cs b/MinecraftClient/Protocol/ChatParser.cs
similarity index 99%
rename from MinecraftClient/Protocol/Handlers/ChatParser.cs
rename to MinecraftClient/Protocol/ChatParser.cs
index c7ae79dd..9d0e7d12 100644
--- a/MinecraftClient/Protocol/Handlers/ChatParser.cs
+++ b/MinecraftClient/Protocol/ChatParser.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
-namespace MinecraftClient.Protocol.Handlers
+namespace MinecraftClient.Protocol
{
///
/// This class parses JSON chat data from MC 1.6+ and returns the appropriate string to be printed.
diff --git a/MinecraftClient/Protocol/Handlers/Protocol16.cs b/MinecraftClient/Protocol/Handlers/Protocol16.cs
index 3e3a5d87..92f0fc87 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol16.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol16.cs
@@ -88,9 +88,7 @@ namespace MinecraftClient.Protocol.Handlers
case 0x02: readData(1); readNextString(); readNextString(); readData(4); break;
case 0x03:
string message = readNextString();
- List links = new List();
- if (protocolversion >= 72) { message = ChatParser.ParseText(message, links); }
- handler.OnTextReceived(message, links); break;
+ handler.OnTextReceived(message, protocolversion >= 72); break;
case 0x04: readData(16); break;
case 0x05: readData(6); readNextItemSlot(); break;
case 0x06: readData(12); break;
diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs
index 75cca82b..c64251e9 100644
--- a/MinecraftClient/Protocol/Handlers/Protocol18.cs
+++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs
@@ -258,8 +258,7 @@ namespace MinecraftClient.Protocol.Handlers
break;
}
catch (ArgumentOutOfRangeException) { /* No message type */ }
- List links = new List();
- handler.OnTextReceived(ChatParser.ParseText(message, links), links);
+ handler.OnTextReceived(message, true);
break;
case PacketIncomingType.Respawn:
this.currentDimension = readNextInt(packetData);
diff --git a/MinecraftClient/Protocol/IMinecraftComHandler.cs b/MinecraftClient/Protocol/IMinecraftComHandler.cs
index 32870335..110e898a 100644
--- a/MinecraftClient/Protocol/IMinecraftComHandler.cs
+++ b/MinecraftClient/Protocol/IMinecraftComHandler.cs
@@ -35,8 +35,8 @@ namespace MinecraftClient.Protocol
/// This method is called when the protocol handler receives a chat message
///
/// Text received from the server
- /// Links embedded in text (for click events)
- void OnTextReceived(string text, IEnumerable links);
+ /// TRUE if the text is JSON-Encoded
+ void OnTextReceived(string text, bool isJson);
///
/// This method is called when a new player joins the game