From 385a1f99b11d0ab3748d27ad934f1fe902030c52 Mon Sep 17 00:00:00 2001 From: ZizzyDizzyMC Date: Fri, 4 Sep 2015 09:16:28 -0400 Subject: [PATCH 1/2] Added another setting. Added vanillaandfactionsmessages setting that enables / disables detection of vanilla / factions public chat messages. Setting has been added to the auto-generated MinecraftClient.ini and has been commented with respective chat format of " message" and "<*faction user>: message" Clause added to ChatBot.cs that makes use of the new setting. --- MinecraftClient/ChatBot.cs | 2 +- MinecraftClient/Settings.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/MinecraftClient/ChatBot.cs b/MinecraftClient/ChatBot.cs index ebdbcc08..5d568289 100644 --- a/MinecraftClient/ChatBot.cs +++ b/MinecraftClient/ChatBot.cs @@ -266,7 +266,7 @@ namespace MinecraftClient //<*Faction Someone> message //<*Faction Someone>: message //<*Faction ~Nicknamed>: message - if (text[0] == '<') + if (text[0] == '<' && Settings.Vanilla_And_Factions_Messages_Enabled.Equals(true)) { try { diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index ee14b0e1..ae231d63 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -93,6 +93,7 @@ namespace MinecraftClient //Chat Message Enabled / Disabled. public static bool Hero_Chat_Messages_Enabled = true; public static bool Unknown_Chat_Plugin_Messages_One_Enabled = true; + public static bool Vanilla_And_Factions_Messages_Enabled = true; //Auto Respond public static bool AutoRespond_Enabled = false; @@ -295,7 +296,8 @@ namespace MinecraftClient { case "herochatmessagesenabled": Hero_Chat_Messages_Enabled = str2bool(argValue); break; case "unknownchatpluginmessagesone": Unknown_Chat_Plugin_Messages_One_Enabled = str2bool(argValue); break; - + case "vanillaandfactionsmessages": Vanilla_And_Factions_Messages_Enabled = str2bool(argValue); break; + } break; @@ -438,6 +440,7 @@ namespace MinecraftClient + "tpaccepteveryone=false\r\n" + "\r\n" + "[ChatBotMessages]\r\n" + + "vanillaandfactionsmessages=true # Chat Formats \" Message\" \"<*Faction User>: Message\" \r\n" + "herochatmessagesenabled=true # Chat Format is \"[Channel][Rank] User: Message\"\r\n" + "unknownchatpluginmessagesone=true # Chat Format is \"**Faction User : Message\"\r\n" + "\r\n" From 1223c91d79c67a144176a49c95484f947ebfec17 Mon Sep 17 00:00:00 2001 From: ZizzyDizzyMC Date: Fri, 4 Sep 2015 09:54:38 -0400 Subject: [PATCH 2/2] Added setting to make sending brand info optional. sendbrandinfo=true|false was added so we can optionally send client info. Enabled by default. Added sendbrandinfo into auto-generated ini file. Edited Protocol18.cs to reflect this with an "if" statement before SendBrandInfo() is called upon. Fixed minor mistake of not adding chatbotmessages into Parsemode. Parsemode.Default was being used. --- MinecraftClient/Protocol/Handlers/Protocol18.cs | 5 ++++- MinecraftClient/Settings.cs | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/MinecraftClient/Protocol/Handlers/Protocol18.cs b/MinecraftClient/Protocol/Handlers/Protocol18.cs index c6357f73..26054daf 100644 --- a/MinecraftClient/Protocol/Handlers/Protocol18.cs +++ b/MinecraftClient/Protocol/Handlers/Protocol18.cs @@ -140,7 +140,10 @@ namespace MinecraftClient.Protocol.Handlers SendPacket(0x00, packetData); break; case 0x01: //Join game - SendBrandInfo(); + if (Settings.SendBrandInfoEnabled.Equals(true)) + { + SendBrandInfo(); + } break; case 0x02: //Chat message handler.OnTextReceived(ChatParser.ParseText(readNextString(ref packetData))); diff --git a/MinecraftClient/Settings.cs b/MinecraftClient/Settings.cs index ae231d63..93beb6a8 100644 --- a/MinecraftClient/Settings.cs +++ b/MinecraftClient/Settings.cs @@ -46,6 +46,7 @@ namespace MinecraftClient public static bool playerHeadAsIcon = false; public static string chatbotLogFile = ""; public static bool CacheScripts = true; + public static bool SendBrandInfoEnabled = true; //AntiAFK Settings public static bool AntiAFK_Enabled = false; @@ -139,6 +140,7 @@ namespace MinecraftClient case "proxy": pMode = ParseMode.Proxy; break; case "appvars": pMode = ParseMode.AppVars; break; case "autorespond": pMode = ParseMode.AutoRespond; break; + case "chatbotmessages": pMode = ParseMode.ChatBotMessages; break; default: pMode = ParseMode.Default; break; } } @@ -166,6 +168,7 @@ namespace MinecraftClient case "mcversion": ServerVersion = argValue; break; case "splitmessagedelay": splitMessageDelay = TimeSpan.FromSeconds(str2int(argValue)); break; case "scriptcache": CacheScripts = str2bool(argValue); break; + case "sendbrandinfo": SendBrandInfoEnabled = str2bool(argValue); break; case "botowners": Bots_Owners.Clear(); @@ -386,6 +389,7 @@ namespace MinecraftClient + "exitonfailure=false\r\n" + "scriptcache=true\r\n" + "timestamps=false\r\n" + + "sendbrandinfo=true\r\n" + "\r\n" + "[AppVars]\r\n" + "#yourvar=yourvalue\r\n"