From 88c9605e940b0c5d1e548f7e57cb869ee429f221 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 2 Sep 2015 23:01:01 -0400 Subject: [PATCH] Added a new PM regex Added [someone @ me] message so that remote control could be used on more servers. Added back Hero Chat Messages with a default config option of; herochatmessagesenabled=false which safely disables it for everyone and has to be explicitly enabled for it to goof anything up. How this happened was me downloading the "source" from minecraft forums and modifying that source then trying to merge it back to the main github fork of mine. --- .vs/MinecraftClient/v14/.suo | Bin 0 -> 3584 bytes MinecraftClient/ChatBot.cs | 22 ++++++++++++++++++++++ MinecraftClient/Settings.cs | 3 +++ 3 files changed, 25 insertions(+) create mode 100644 .vs/MinecraftClient/v14/.suo diff --git a/.vs/MinecraftClient/v14/.suo b/.vs/MinecraftClient/v14/.suo new file mode 100644 index 0000000000000000000000000000000000000000..9b02a86378d3ff782804856f32fdca328b07c6a2 GIT binary patch literal 3584 zcmca`Uhu)fjZzO8(10BSGsD0CoD6J8;*3Bx6O1pwz`z1zgT(&*|NkE(%nZap<|r6K zA@CRIR#5znf{_^lK@9moSi+#d;L4B(q>C6TL0Oq-AjZIolIMxh2rDm$QA>;(etC4yf%0YR`em9P)QxOY4A9;TaLMfibV&)&y~#i~86-q%&q+PEFx@fDg_$jR mA~1=gl-Hne0Ev+cUdWqU*~urSWXP>Q!M3qChg@?8N*@4)1zMs2 literal 0 HcmV?d00001 diff --git a/MinecraftClient/ChatBot.cs b/MinecraftClient/ChatBot.cs index 4c0a5c09..27459bf9 100644 --- a/MinecraftClient/ChatBot.cs +++ b/MinecraftClient/ChatBot.cs @@ -197,6 +197,17 @@ namespace MinecraftClient return IsValidName(sender); } + //Detect Modified server messages. /m + //[Someone @ me] message + else if (text[0] == '[' && tmp.Length > 3 && tmp[1] == "@" + && (tmp[2] == "me]" || tmp[2] == "moi]")) //'me' is replaced by 'moi' in french servers + { + message = text.Substring(tmp[0].Length + 4 + tmp[2].Length + 0); + sender = tmp[0].Substring(1); + if (sender[0] == '~') { sender = sender.Substring(1); } + return IsValidName(sender); + } + //Detect Essentials (Bukkit) /me messages with some custom prefix //[Prefix] [Someone -> me] message //[Prefix] [~Someone -> me] message @@ -231,6 +242,17 @@ namespace MinecraftClient return IsValidName(sender); } + //Detect HeroChat Messages + //[Channel] [Rank] User: Message + else if (text.StartsWith("[") && text.Contains(':') && tmp.Length > 2 && Settings.Hero_Chat_Messages_Enabled.Equals(true)) + { + int name_end = text.IndexOf(':'); + int name_start = text.Substring(0, name_end).LastIndexOf(']') + 2; + sender = text.Substring(name_start, name_end - name_start); + message = text.Substring(name_end + 2); + return IsValidName(sender); + } + else return false; } catch (IndexOutOfRangeException) { return false; } diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index 40a51cb1..d09a5912 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -89,6 +89,7 @@ namespace MinecraftClient public static bool RemoteCtrl_Enabled = false; public static bool RemoteCtrl_AutoTpaccept = true; public static bool RemoteCtrl_AutoTpaccept_Everyone = false; + public static bool Hero_Chat_Messages_Enabled = false; //Auto Respond public static bool AutoRespond_Enabled = false; @@ -282,6 +283,7 @@ namespace MinecraftClient case "enabled": RemoteCtrl_Enabled = str2bool(argValue); break; case "autotpaccept": RemoteCtrl_AutoTpaccept = str2bool(argValue); break; case "tpaccepteveryone": RemoteCtrl_AutoTpaccept_Everyone = str2bool(argValue); break; + case "herochatmessagesenabled": Hero_Chat_Messages_Enabled = str2bool(argValue); break; } break; @@ -422,6 +424,7 @@ namespace MinecraftClient + "enabled=false\r\n" + "autotpaccept=true\r\n" + "tpaccepteveryone=false\r\n" + + "herochatmessagesenabled=false\r\n" + "\r\n" + "[AutoRespond]\r\n" + "enabled=false\r\n"