mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #350 from kalilistic/expose-chat-type
This commit is contained in:
commit
d3b8f8494b
2 changed files with 26 additions and 0 deletions
|
|
@ -17,6 +17,17 @@ namespace Dalamud.Configuration
|
|||
[JsonIgnore]
|
||||
private string configPath;
|
||||
|
||||
/// <summary>
|
||||
/// Delegate for the <see cref="DalamudConfiguration.OnDalamudConfigurationSaved"/> event that occurs when the dalamud configuration is saved.
|
||||
/// </summary>
|
||||
/// <param name="dalamudConfiguration">The current dalamud configuration.</param>
|
||||
public delegate void DalamudConfigurationSavedDelegate(DalamudConfiguration dalamudConfiguration);
|
||||
|
||||
/// <summary>
|
||||
/// Event that occurs when dalamud configuration is saved.
|
||||
/// </summary>
|
||||
public event DalamudConfigurationSavedDelegate OnDalamudConfigurationSaved;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of muted works.
|
||||
/// </summary>
|
||||
|
|
@ -156,6 +167,7 @@ namespace Dalamud.Configuration
|
|||
public void Save()
|
||||
{
|
||||
File.WriteAllText(this.configPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||
this.OnDalamudConfigurationSaved?.Invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using Dalamud.Game;
|
|||
using Dalamud.Game.ClientState;
|
||||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Internal;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.Sanitizer;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||
|
|
@ -50,6 +51,7 @@ namespace Dalamud.Plugin
|
|||
this.pluginName = pluginName;
|
||||
this.configs = configs;
|
||||
|
||||
this.GeneralChatType = this.dalamud.Configuration.GeneralChatType;
|
||||
this.Sanitizer = new Sanitizer(this.Data.Language);
|
||||
if (this.dalamud.Configuration.LanguageOverride != null)
|
||||
{
|
||||
|
|
@ -65,6 +67,7 @@ namespace Dalamud.Plugin
|
|||
}
|
||||
|
||||
dalamud.LocalizationManager.OnLocalizationChanged += this.OnLocalizationChanged;
|
||||
dalamud.Configuration.OnDalamudConfigurationSaved += this.OnDalamudConfigurationSaved;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -152,6 +155,11 @@ namespace Dalamud.Plugin
|
|||
/// </summary>
|
||||
public ISanitizer Sanitizer { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the chat type used by default for plugin messages.
|
||||
/// </summary>
|
||||
public XivChatType GeneralChatType { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the action that should be executed when any plugin sends a message.
|
||||
/// </summary>
|
||||
|
|
@ -374,6 +382,7 @@ namespace Dalamud.Plugin
|
|||
this.UiBuilder.Dispose();
|
||||
this.Framework.Gui.Chat.RemoveChatLinkHandler(this.pluginName);
|
||||
this.dalamud.LocalizationManager.OnLocalizationChanged -= this.OnLocalizationChanged;
|
||||
this.dalamud.Configuration.OnDalamudConfigurationSaved -= this.OnDalamudConfigurationSaved;
|
||||
}
|
||||
|
||||
private void OnLocalizationChanged(string langCode)
|
||||
|
|
@ -381,5 +390,10 @@ namespace Dalamud.Plugin
|
|||
this.UiLanguage = langCode;
|
||||
this.OnLanguageChanged?.Invoke(langCode);
|
||||
}
|
||||
|
||||
private void OnDalamudConfigurationSaved(DalamudConfiguration dalamudConfiguration)
|
||||
{
|
||||
this.GeneralChatType = dalamudConfiguration.GeneralChatType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue