Merge pull request #14

fix: avoid warning logs about extrachat
This commit is contained in:
Infi
2024-04-11 15:33:11 +02:00
committed by GitHub
2 changed files with 21 additions and 2 deletions
+15
View File
@@ -87,6 +87,8 @@ internal static class ChatTypeExt
ChatType.MessageBook,
ChatType.Alarm,
}),
// Note: ExtraChat linkshells are handled separately in the tab settings
// UI.
};
internal static string Name(this ChatType type)
@@ -355,6 +357,19 @@ internal static class ChatTypeExt
_ => false,
};
internal static bool IsExtraChatLinkshell(this ChatType type) => type switch
{
ChatType.ExtraChatLinkshell1 => true,
ChatType.ExtraChatLinkshell2 => true,
ChatType.ExtraChatLinkshell3 => true,
ChatType.ExtraChatLinkshell4 => true,
ChatType.ExtraChatLinkshell5 => true,
ChatType.ExtraChatLinkshell6 => true,
ChatType.ExtraChatLinkshell7 => true,
ChatType.ExtraChatLinkshell8 => true,
_ => false,
};
internal static bool HasSource(this ChatType type) => type switch
{
// Battle
+6 -2
View File
@@ -19,9 +19,13 @@ internal sealed class ChatColours : ISettingsTab {
#if DEBUG
var sortable = ChatTypeExt.SortOrder
.SelectMany(entry => entry.Item2)
.Where(type => !type.IsGm())
// Users can set colours for ExtraChat linkshells in the ExtraChat
// plugin directly.
.Where(type => !type.IsGm() && !type.IsExtraChatLinkshell())
.ToHashSet();
var total = Enum.GetValues<ChatType>()
.Where(type => !type.IsGm() && !type.IsExtraChatLinkshell())
.ToHashSet();
var total = Enum.GetValues<ChatType>().Where(type => !type.IsGm()).ToHashSet();
if (sortable.Count != total.Count) {
Plugin.Log.Warning($"There are {sortable.Count} sortable channels, but there are {total.Count} total channels.");
total.ExceptWith(sortable);