mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Merge pull request #93 from ZizzyDizzyMC/Indev
Add [Username @ me] private message format and add settings for enabling chat formats
This commit is contained in:
commit
d9a916b409
3 changed files with 35 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,3 +3,4 @@
|
|||
/MinecraftClientGUI.v11.suo
|
||||
/MinecraftClientGUI.suo
|
||||
/MinecraftClient.userprefs
|
||||
/.vs/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -230,7 +241,6 @@ namespace MinecraftClient
|
|||
message = text.Substring(text.IndexOf(':') + 2);
|
||||
return IsValidName(sender);
|
||||
}
|
||||
|
||||
else return false;
|
||||
}
|
||||
catch (IndexOutOfRangeException) { return false; }
|
||||
|
|
@ -275,8 +285,9 @@ namespace MinecraftClient
|
|||
}
|
||||
|
||||
//Detect HeroChat Messages
|
||||
//Public chat messages
|
||||
//[Channel] [Rank] User: Message
|
||||
else if (text[0] == '[' && text.Contains(':') && tmp.Length > 2)
|
||||
else if (text[0] == '[' && 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;
|
||||
|
|
@ -295,7 +306,8 @@ namespace MinecraftClient
|
|||
&& text.IndexOf('*') < text.IndexOf('<')
|
||||
&& text.IndexOf('<') < text.IndexOf('>')
|
||||
&& text.IndexOf('>') < text.IndexOf(' ')
|
||||
&& text.IndexOf(' ') < text.IndexOf(':'))
|
||||
&& text.IndexOf(' ') < text.IndexOf(':')
|
||||
&& Settings.Unknown_Chat_Plugin_Messages_One_Enabled.Equals(true))
|
||||
{
|
||||
string prefix = tmp[0];
|
||||
string user = tmp[1];
|
||||
|
|
|
|||
|
|
@ -90,6 +90,10 @@ namespace MinecraftClient
|
|||
public static bool RemoteCtrl_AutoTpaccept = true;
|
||||
public static bool RemoteCtrl_AutoTpaccept_Everyone = false;
|
||||
|
||||
//Chat Message Enabled / Disabled.
|
||||
public static bool Hero_Chat_Messages_Enabled = true;
|
||||
public static bool Unknown_Chat_Plugin_Messages_One_Enabled = true;
|
||||
|
||||
//Auto Respond
|
||||
public static bool AutoRespond_Enabled = false;
|
||||
public static string AutoRespond_Matches = "matches.ini";
|
||||
|
|
@ -99,7 +103,7 @@ namespace MinecraftClient
|
|||
private static readonly Dictionary<string, KeyValuePair<string, string>> Accounts = new Dictionary<string, KeyValuePair<string, string>>();
|
||||
private static readonly Dictionary<string, KeyValuePair<string, ushort>> Servers = new Dictionary<string, KeyValuePair<string, ushort>>();
|
||||
|
||||
private enum ParseMode { Default, Main, AppVars, Proxy, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl, AutoRespond };
|
||||
private enum ParseMode { Default, Main, AppVars, Proxy, AntiAFK, Hangman, Alerts, ChatLog, AutoRelog, ScriptScheduler, RemoteControl, ChatBotMessages, AutoRespond };
|
||||
|
||||
/// <summary>
|
||||
/// Load settings from the give INI file
|
||||
|
|
@ -282,6 +286,16 @@ 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;
|
||||
|
||||
case ParseMode.ChatBotMessages:
|
||||
switch (argName.ToLower())
|
||||
{
|
||||
case "herochatmessagesenabled": Hero_Chat_Messages_Enabled = str2bool(argValue); break;
|
||||
case "unknownchatpluginmessagesone": Unknown_Chat_Plugin_Messages_One_Enabled = str2bool(argValue); break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -423,6 +437,10 @@ namespace MinecraftClient
|
|||
+ "autotpaccept=true\r\n"
|
||||
+ "tpaccepteveryone=false\r\n"
|
||||
+ "\r\n"
|
||||
+ "[ChatBotMessages]\r\n"
|
||||
+ "herochatmessagesenabled=true # Chat Format is \"[Channel][Rank] User: Message\"\r\n"
|
||||
+ "unknownchatpluginmessagesone=true # Chat Format is \"**Faction<Rank> User : Message\"\r\n"
|
||||
+ "\r\n"
|
||||
+ "[AutoRespond]\r\n"
|
||||
+ "enabled=false\r\n"
|
||||
+ "matchesfile=matches.ini\r\n", Encoding.UTF8);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue