From cfb313fa01fb9271db5afbb66508de0009242dc4 Mon Sep 17 00:00:00 2001 From: ORelio Date: Tue, 1 Jul 2014 14:10:29 +0200 Subject: [PATCH] Several fixes Fix Alerts bot not displaying several occurences in a row Fix Script bot not displaying in console what it is performing Fix IOException not caught when connection is lost --- MinecraftClient/ChatBots/Alerts.cs | 2 +- MinecraftClient/ChatBots/Script.cs | 1 + MinecraftClient/Command.cs | 10 +++++++++- MinecraftClient/Protocol/Handlers/Protocol16.cs | 1 + MinecraftClient/Protocol/Handlers/Protocol17.cs | 1 + 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/MinecraftClient/ChatBots/Alerts.cs b/MinecraftClient/ChatBots/Alerts.cs index a5b0794b..5ebc0493 100644 --- a/MinecraftClient/ChatBots/Alerts.cs +++ b/MinecraftClient/ChatBots/Alerts.cs @@ -72,7 +72,7 @@ namespace MinecraftClient.ChatBots Console.ForegroundColor = ConsoleColor.White; //Will be used for text displaying - string[] temp = comp.Split(alert.Split(','), StringSplitOptions.RemoveEmptyEntries); + string[] temp = comp.Split(alert.Split(','), StringSplitOptions.None); int p = 0; //Special case : alert in the beginning of the text diff --git a/MinecraftClient/ChatBots/Script.cs b/MinecraftClient/ChatBots/Script.cs index 63717fcc..9e050a51 100644 --- a/MinecraftClient/ChatBots/Script.cs +++ b/MinecraftClient/ChatBots/Script.cs @@ -106,6 +106,7 @@ namespace MinecraftClient.ChatBots { sleepticks = 0; Update(); //Unknown command : process next line immediately } + else LogToConsole(instruction_line); break; } } diff --git a/MinecraftClient/Command.cs b/MinecraftClient/Command.cs index ea0d2902..ecc5437f 100644 --- a/MinecraftClient/Command.cs +++ b/MinecraftClient/Command.cs @@ -72,7 +72,15 @@ namespace MinecraftClient public static string[] getArgs(string command) { - return getArg(command).Split(' '); + string[] args = getArg(command).Split(' '); + if (args.Length == 1 && args[0] == "") + { + return new string[] { }; + } + else + { + return args; + } } } } diff --git a/MinecraftClient/Protocol/Handlers/Protocol16.cs b/MinecraftClient/Protocol/Handlers/Protocol16.cs index 16cd92a1..4af70ab1 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol16.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol16.cs @@ -593,6 +593,7 @@ namespace MinecraftClient.Protocol.Handlers return true; } catch (SocketException) { return false; } + catch (System.IO.IOException) { return false; } } public bool SendRespawnPacket() diff --git a/MinecraftClient/Protocol/Handlers/Protocol17.cs b/MinecraftClient/Protocol/Handlers/Protocol17.cs index 42fa4a8d..62b65fb8 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol17.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol17.cs @@ -422,6 +422,7 @@ namespace MinecraftClient.Protocol.Handlers return true; } catch (SocketException) { return false; } + catch (System.IO.IOException) { return false; } } ///