mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Chat Format: increase priority of custom regex
If a custom regex is defined in config, process it first. Previous behavior was to process builtins first. Should reduce issues with custom regex and builtins=true
This commit is contained in:
parent
2ebc8eded5
commit
80d51ede31
1 changed files with 36 additions and 36 deletions
|
|
@ -241,6 +241,18 @@ namespace MinecraftClient
|
|||
|
||||
text = GetVerbatim(text);
|
||||
|
||||
//User-defined regex for private chat messages
|
||||
if (Settings.ChatFormat_Private != null)
|
||||
{
|
||||
Match regexMatch = Settings.ChatFormat_Private.Match(text);
|
||||
if (regexMatch.Success && regexMatch.Groups.Count >= 3)
|
||||
{
|
||||
sender = regexMatch.Groups[1].Value;
|
||||
message = regexMatch.Groups[2].Value;
|
||||
return IsValidName(sender);
|
||||
}
|
||||
}
|
||||
|
||||
//Built-in detection routine for private messages
|
||||
if (Settings.ChatFormat_Builtins)
|
||||
{
|
||||
|
|
@ -323,18 +335,6 @@ namespace MinecraftClient
|
|||
catch (ArgumentOutOfRangeException) { /* Same here */ }
|
||||
}
|
||||
|
||||
//User-defined regex for private chat messages
|
||||
if (Settings.ChatFormat_Private != null)
|
||||
{
|
||||
Match regexMatch = Settings.ChatFormat_Private.Match(text);
|
||||
if (regexMatch.Success && regexMatch.Groups.Count >= 3)
|
||||
{
|
||||
sender = regexMatch.Groups[1].Value;
|
||||
message = regexMatch.Groups[2].Value;
|
||||
return IsValidName(sender);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +351,19 @@ namespace MinecraftClient
|
|||
return false;
|
||||
|
||||
text = GetVerbatim(text);
|
||||
|
||||
|
||||
//User-defined regex for public chat messages
|
||||
if (Settings.ChatFormat_Public != null)
|
||||
{
|
||||
Match regexMatch = Settings.ChatFormat_Public.Match(text);
|
||||
if (regexMatch.Success && regexMatch.Groups.Count >= 3)
|
||||
{
|
||||
sender = regexMatch.Groups[1].Value;
|
||||
message = regexMatch.Groups[2].Value;
|
||||
return IsValidName(sender);
|
||||
}
|
||||
}
|
||||
|
||||
//Built-in detection routine for public messages
|
||||
if (Settings.ChatFormat_Builtins)
|
||||
{
|
||||
|
|
@ -427,18 +439,6 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
//User-defined regex for public chat messages
|
||||
if (Settings.ChatFormat_Public != null)
|
||||
{
|
||||
Match regexMatch = Settings.ChatFormat_Public.Match(text);
|
||||
if (regexMatch.Success && regexMatch.Groups.Count >= 3)
|
||||
{
|
||||
sender = regexMatch.Groups[1].Value;
|
||||
message = regexMatch.Groups[2].Value;
|
||||
return IsValidName(sender);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -455,6 +455,17 @@ namespace MinecraftClient
|
|||
|
||||
text = GetVerbatim(text);
|
||||
|
||||
//User-defined regex for teleport requests
|
||||
if (Settings.ChatFormat_TeleportRequest != null)
|
||||
{
|
||||
Match regexMatch = Settings.ChatFormat_TeleportRequest.Match(text);
|
||||
if (regexMatch.Success && regexMatch.Groups.Count >= 2)
|
||||
{
|
||||
sender = regexMatch.Groups[1].Value;
|
||||
return IsValidName(sender);
|
||||
}
|
||||
}
|
||||
|
||||
//Built-in detection routine for teleport requests
|
||||
if (Settings.ChatFormat_Builtins)
|
||||
{
|
||||
|
|
@ -484,17 +495,6 @@ namespace MinecraftClient
|
|||
}
|
||||
}
|
||||
|
||||
//User-defined regex for teleport requests
|
||||
if (Settings.ChatFormat_TeleportRequest != null)
|
||||
{
|
||||
Match regexMatch = Settings.ChatFormat_TeleportRequest.Match(text);
|
||||
if (regexMatch.Success && regexMatch.Groups.Count >= 2)
|
||||
{
|
||||
sender = regexMatch.Groups[1].Value;
|
||||
return IsValidName(sender);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue