From 117cc3ef449c115730f748d2a2d56a7333dfdece Mon Sep 17 00:00:00 2001 From: goat Date: Mon, 23 Mar 2020 20:19:17 +0900 Subject: [PATCH] feat: add warning message on login when plugins need an update --- Dalamud/Game/ChatHandlers.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Dalamud/Game/ChatHandlers.cs b/Dalamud/Game/ChatHandlers.cs index 262a8385a..4d5861f23 100644 --- a/Dalamud/Game/ChatHandlers.cs +++ b/Dalamud/Game/ChatHandlers.cs @@ -10,6 +10,7 @@ using Dalamud.Game.Chat; using Dalamud.Game.Chat.SeStringHandling; using Dalamud.Game.Chat.SeStringHandling.Payloads; using Dalamud.Game.Internal.Libc; +using Dalamud.Plugin; using Serilog; namespace Dalamud.Game { @@ -113,12 +114,26 @@ namespace Dalamud.Game { if (string.IsNullOrEmpty(this.dalamud.Configuration.LastVersion) || !assemblyVersion.StartsWith(this.dalamud.Configuration.LastVersion)) { this.dalamud.Framework.Gui.Chat.PrintChat(new XivChatEntry { MessageBytes = Encoding.UTF8.GetBytes("The In-Game addon has been updated or was reinstalled successfully! Please check the discord for a full changelog."), - Type = XivChatType.Urgent + Type = XivChatType.Notice }); this.dalamud.Configuration.LastVersion = assemblyVersion; this.dalamud.Configuration.Save(this.dalamud.StartInfo.ConfigurationPath); } + + try { + var hasNeedsUpdate = this.dalamud.PluginRepository.UpdatePlugins(true).UpdatedCount != 0; + + if (hasNeedsUpdate) { + this.dalamud.Framework.Gui.Chat.PrintChat(new XivChatEntry + { + MessageBytes = Encoding.UTF8.GetBytes("One or more of your plugins needs to be updated. Please use the /xlplugins command in-game to update them!"), + Type = XivChatType.Urgent + }); + } + } catch (Exception e) { + Log.Error(e, "Could not check for plugin updates."); + } } #if !DEBUG && false