diff --git a/PlayerTags/Features/ChatTagTargetFeature.cs b/PlayerTags/Features/ChatTagTargetFeature.cs index 5906835..72508c7 100644 --- a/PlayerTags/Features/ChatTagTargetFeature.cs +++ b/PlayerTags/Features/ChatTagTargetFeature.cs @@ -257,6 +257,13 @@ namespace PlayerTags.Features ApplyStringChanges(message, stringChanges, stringMatch.PreferredPayload); } + + // Replace PlayerPayloads of your own character with TextPayloads + foreach (var payload in message.Payloads.ToArray()) + { + if (payload is PlayerPayload playerPayload && playerPayload.PlayerName.Contains(PluginServices.ClientState.LocalPlayer.Name.TextValue)) + message.Payloads.Remove(payload); + } } } } diff --git a/PlayerTags/Features/LinkSelfInChatFeature.cs b/PlayerTags/Features/LinkSelfInChatFeature.cs index 56eae2d..85d0292 100644 --- a/PlayerTags/Features/LinkSelfInChatFeature.cs +++ b/PlayerTags/Features/LinkSelfInChatFeature.cs @@ -116,9 +116,8 @@ namespace PlayerTags.Features // Normally used to end PlayerPayload linking. But for the own player it has no affect. Anyway, use it, just because. Maybe it's needed in the future somewhere else. seString.Payloads.Insert(++playerPayloadIndex, RawPayload.LinkTerminator); - // Remove the text payload (display text) - if (ShouldRemovePlayerNameTextPayload?.Invoke(this) ?? true) - seString.Payloads.Remove(playerTextPayload); + // The PlayerPayload is just temporary. We keep the TextPayload. + // The PayerPayload gets removed at the ChatTagTargetFeature at the end. } } } diff --git a/PlayerTags/Plugin.cs b/PlayerTags/Plugin.cs index 10b45ce..908abb1 100644 --- a/PlayerTags/Plugin.cs +++ b/PlayerTags/Plugin.cs @@ -44,7 +44,6 @@ namespace PlayerTags UiBuilder_OpenConfigUi(); }) { HelpMessage = "Shows the config" }); m_LinkSelfInChatFeature = new LinkSelfInChatFeature(m_PluginConfiguration, m_PluginData); - m_LinkSelfInChatFeature.ShouldRemovePlayerNameTextPayload += LinkSelfInChatFeature_ShouldRemovePlayerNameTextPayload; m_CustomTagsContextMenuFeature = new CustomTagsContextMenuFeature(m_PluginConfiguration, m_PluginData); m_NameplatesTagTargetFeature = new NameplateTagTargetFeature(m_PluginConfiguration, m_PluginData); m_ChatTagTargetFeature = new ChatTagTargetFeature(m_PluginConfiguration, m_PluginData); @@ -62,18 +61,6 @@ namespace PlayerTags PluginServices.DalamudPluginInterface.UiBuilder.Draw -= UiBuilder_Draw; } - private bool LinkSelfInChatFeature_ShouldRemovePlayerNameTextPayload(object sender) - { - return !IsChatTwoActive(); - } - - private bool IsChatTwoActive() - { - var file = Path.Combine(Path.GetDirectoryName(PluginServices.DalamudPluginInterface.ConfigDirectory.FullName), @"ChatTwo\chat-log.db"); - var exists = File.Exists(file); - return exists; - } - private void DalamudPluginInterface_LanguageChanged(string langCode) { Localizer.SetLanguage(langCode);