mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +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]
|
[JsonIgnore]
|
||||||
private string configPath;
|
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>
|
/// <summary>
|
||||||
/// Gets or sets a list of muted works.
|
/// Gets or sets a list of muted works.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -156,6 +167,7 @@ namespace Dalamud.Configuration
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
File.WriteAllText(this.configPath, JsonConvert.SerializeObject(this, Formatting.Indented));
|
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.ClientState;
|
||||||
using Dalamud.Game.Command;
|
using Dalamud.Game.Command;
|
||||||
using Dalamud.Game.Internal;
|
using Dalamud.Game.Internal;
|
||||||
|
using Dalamud.Game.Text;
|
||||||
using Dalamud.Game.Text.Sanitizer;
|
using Dalamud.Game.Text.Sanitizer;
|
||||||
using Dalamud.Game.Text.SeStringHandling;
|
using Dalamud.Game.Text.SeStringHandling;
|
||||||
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
using Dalamud.Game.Text.SeStringHandling.Payloads;
|
||||||
|
|
@ -50,6 +51,7 @@ namespace Dalamud.Plugin
|
||||||
this.pluginName = pluginName;
|
this.pluginName = pluginName;
|
||||||
this.configs = configs;
|
this.configs = configs;
|
||||||
|
|
||||||
|
this.GeneralChatType = this.dalamud.Configuration.GeneralChatType;
|
||||||
this.Sanitizer = new Sanitizer(this.Data.Language);
|
this.Sanitizer = new Sanitizer(this.Data.Language);
|
||||||
if (this.dalamud.Configuration.LanguageOverride != null)
|
if (this.dalamud.Configuration.LanguageOverride != null)
|
||||||
{
|
{
|
||||||
|
|
@ -65,6 +67,7 @@ namespace Dalamud.Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
dalamud.LocalizationManager.OnLocalizationChanged += this.OnLocalizationChanged;
|
dalamud.LocalizationManager.OnLocalizationChanged += this.OnLocalizationChanged;
|
||||||
|
dalamud.Configuration.OnDalamudConfigurationSaved += this.OnDalamudConfigurationSaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -152,6 +155,11 @@ namespace Dalamud.Plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ISanitizer Sanitizer { get; }
|
public ISanitizer Sanitizer { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the chat type used by default for plugin messages.
|
||||||
|
/// </summary>
|
||||||
|
public XivChatType GeneralChatType { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the action that should be executed when any plugin sends a message.
|
/// Gets the action that should be executed when any plugin sends a message.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -374,6 +382,7 @@ namespace Dalamud.Plugin
|
||||||
this.UiBuilder.Dispose();
|
this.UiBuilder.Dispose();
|
||||||
this.Framework.Gui.Chat.RemoveChatLinkHandler(this.pluginName);
|
this.Framework.Gui.Chat.RemoveChatLinkHandler(this.pluginName);
|
||||||
this.dalamud.LocalizationManager.OnLocalizationChanged -= this.OnLocalizationChanged;
|
this.dalamud.LocalizationManager.OnLocalizationChanged -= this.OnLocalizationChanged;
|
||||||
|
this.dalamud.Configuration.OnDalamudConfigurationSaved -= this.OnDalamudConfigurationSaved;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLocalizationChanged(string langCode)
|
private void OnLocalizationChanged(string langCode)
|
||||||
|
|
@ -381,5 +390,10 @@ namespace Dalamud.Plugin
|
||||||
this.UiLanguage = langCode;
|
this.UiLanguage = langCode;
|
||||||
this.OnLanguageChanged?.Invoke(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