From 59a53beae5b9a272ea128ef6c132a18123e0dd32 Mon Sep 17 00:00:00 2001 From: Controllerdestiny <523321293@qq.com> Date: Sun, 23 Jun 2024 20:08:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0:=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AutoPluginManager.csproj | 0 AutoPluginManager/Plugin.cs | 339 ++++++++++++++++++ .../PluginUpdateInfo.cs | 2 +- .../PluginVersionInfo.cs | 2 +- AutoPluginManager/README.md | 31 ++ AutoUpdatePlugin/Plugin.cs | 231 ------------ AutoUpdatePlugin/README.md | 27 -- Plugin.sln | 18 +- README.md | 2 +- 9 files changed, 382 insertions(+), 270 deletions(-) rename AutoUpdatePlugin/AutoUpdatePlugin.csproj => AutoPluginManager/AutoPluginManager.csproj (100%) create mode 100644 AutoPluginManager/Plugin.cs rename {AutoUpdatePlugin => AutoPluginManager}/PluginUpdateInfo.cs (94%) rename {AutoUpdatePlugin => AutoPluginManager}/PluginVersionInfo.cs (92%) create mode 100644 AutoPluginManager/README.md delete mode 100644 AutoUpdatePlugin/Plugin.cs delete mode 100644 AutoUpdatePlugin/README.md diff --git a/AutoUpdatePlugin/AutoUpdatePlugin.csproj b/AutoPluginManager/AutoPluginManager.csproj similarity index 100% rename from AutoUpdatePlugin/AutoUpdatePlugin.csproj rename to AutoPluginManager/AutoPluginManager.csproj diff --git a/AutoPluginManager/Plugin.cs b/AutoPluginManager/Plugin.cs new file mode 100644 index 000000000..1a6593549 --- /dev/null +++ b/AutoPluginManager/Plugin.cs @@ -0,0 +1,339 @@ +using Newtonsoft.Json; +using System.IO.Compression; +using System.Reflection; +using Terraria; +using TerrariaApi.Server; +using TShockAPI; + +namespace AutoPluginManager; + +[ApiVersion(2, 1)] +public class Plugin : TerrariaPlugin +{ + public override string Name => "AutoUpdatePlugin"; + + public override Version Version => new(2, 0, 0, 0); + + public override string Author => "少司命,Cai"; + + public override string Description => "自动更新你的插件!"; + + private const string ReleaseUrl = "https://github.com/Controllerdestiny/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip"; + + private const string PUrl = "https://github.moeyy.xyz/"; + + private const string PluginsUrl = "https://raw.githubusercontent.com/Controllerdestiny/TShockPlugin/master/Plugins.json"; + + private static readonly HttpClient _httpClient = new(); + + private const string TempSaveDir = "TempFile"; + + private const string TempZipName = "Plugins.zip"; + + private readonly System.Timers.Timer _timer = new(); + + public Plugin(Main game) : base(game) + { + + } + + public override void Initialize() + { + Commands.ChatCommands.Add(new("AutoUpdatePlugin", PluginManager, "apm")); + ServerApi.Hooks.GamePostInitialize.Register(this, AutoCheckUpdate, int.MinValue); //最低优先级 + } + + + + protected override void Dispose(bool disposing) + { + if (disposing) + { + + ServerApi.Hooks.GamePostInitialize.Deregister(this, AutoCheckUpdate); + } + + base.Dispose(disposing); + } + + private void AutoCheckUpdate(EventArgs args) + { + _timer.AutoReset = true; + _timer.Enabled = true; + _timer.Interval = 60 * 30 * 1000; + _timer.Elapsed += (_, _) => + { + try + { + var updates = GetUpdates(); + if (updates.Any()) + { + TShock.Log.ConsoleInfo("[以下插件有新的版本更新]\n" + string.Join("\n", updates.Select(i => $"[{i.Name}] V{i.OldVersion} >>> V{i.NewVersion}"))); + TShock.Log.ConsoleInfo("你可以使用命令/uplugin更新插件哦~"); + } + + } + catch (Exception ex) + { + TShock.Log.ConsoleInfo("[AutoUpdate]无法获取更新:" + ex.Message); + return; + } + }; + _timer.Start(); + } + + private void PluginManager(CommandArgs args) + { + if (args.Parameters.Count == 1 && args.Parameters[0].ToLower() == "-c") + { + CheckCmd(args.Player); + } + else if (args.Parameters.Count >= 1 && args.Parameters[0].ToLower() == "-u") + { + var targets = Array.Empty(); + if (args.Parameters.Count > 1) + targets = args.Parameters[1].Split(","); + UpdateCmd(args.Player, targets); + } + else if (args.Parameters.Count == 2 && args.Parameters[0].ToLower() == "-i") + { + var indexs = args.Parameters[1].Split(",").Select(x => + { + if (int.TryParse(x, out var index)) + return index; + return -1; + }); + InstallCmd(args.Player, indexs); + } + else if (args.Parameters.Count == 1 && args.Parameters[0].ToLower() == "-l") + { + var repo = GetRepoPlugin(); + args.Player.SendInfoMessage("可安装插件列表:"); + for (int i = 0; i < repo.Count; i++) + args.Player.SendInfoMessage($"{i + 1}.{repo[i].Name} {repo[i].Path} {repo[i].Version}"); + } + else + { + args.Player.SendInfoMessage("apm -c 检测已安装插件更新"); + args.Player.SendInfoMessage("apm -u [插件名] 更新所有插件或指定插件"); + args.Player.SendInfoMessage("apm -i [序号] 安装指定插件"); + args.Player.SendInfoMessage("apm -l 查看可安装插件表"); + } + } + + private void InstallCmd(TSPlayer Player, IEnumerable target) + { + if (!target.Any()) + { + Player.SendErrorMessage("无效参数,请附带需要安装插件的选择项!"); + return; + } + try + { + var plugins = GetRepoPlugin(); + var installs = new List(); + foreach (var index in target) + { + if (index > 0 && index <= plugins.Count) + { + installs.Add(plugins[index - 1]); + } + } + if (installs.Count == 0) + { + Player.SendErrorMessage("序号无效,请附带需要安装插件的选择项!"); + return; + } + Player.SendInfoMessage("正在下载最新插件包..."); + DownLoadPlugin(); + Player.SendInfoMessage("正在解压插件包..."); + ExtractDirectoryZip(); + Player.SendInfoMessage("正在安装插件..."); + InstallPlugin(installs); + Player.SendSuccessMessage("[安装完成]\n" + string.Join("\n", installs.Select(i => $"[{i.Name}] V{i.Version}"))); + Player.SendSuccessMessage("重启服务器后插件生效!"); + } + catch (Exception ex) + { + Player.SendErrorMessage("安装插件出现错误:" + ex.Message); + } + } + + private void UpdateCmd(TSPlayer Player, string[] target) + { + try + { + var updates = GetUpdates(); + if (updates.Count == 0) + { + Player.SendSuccessMessage("你的插件全是最新版本,无需更新哦~"); + return; + } + if (target.Length != 0) + { + updates = updates.Where(i => target.Contains(i.Name)).ToList(); + if (!updates.Any()) + { + Player.SendErrorMessage($"{string.Join(",", target)} 无需更新!"); + return; + } + } + Player.SendInfoMessage("正在下载最新插件包..."); + DownLoadPlugin(); + Player.SendInfoMessage("正在解压插件包..."); + ExtractDirectoryZip(); + Player.SendInfoMessage("正在升级插件..."); + var success = UpdatePlugin(updates); + if (success.Count == 0) + { + Player.SendSuccessMessage("更新了个寂寞~"); + return; + } + Player.SendSuccessMessage("[更新完成]\n" + string.Join("\n", success.Select(i => $"[{i.Name}] V{i.OldVersion} >>> V{i.NewVersion}"))); + Player.SendSuccessMessage("重启服务器后插件生效!"); + } + catch (Exception ex) + { + Player.SendErrorMessage("自动更新出现错误:" + ex.Message); + return; + } + } + + private void CheckCmd(TSPlayer Player) + { + try + { + var updates = GetUpdates(); + if (updates.Count == 0) + { + Player.SendSuccessMessage("你的插件全是最新版本,无需更新哦~"); + return; + } + Player.SendInfoMessage("[以下插件有新的版本更新]\n" + string.Join("\n", updates.Select(i => $"[{i.Name}] V{i.OldVersion} >>> V{i.NewVersion}"))); + } + catch (Exception ex) + { + Player.SendErrorMessage("无法获取更新:" + ex.Message); + return; + } + } + + #region 工具方法 + private static List GetUpdates() + { + var plugins = GetPlugins(); + var latestPluginList = GetRepoPlugin(); + List pluginUpdateList = new(); + foreach (var latestPluginInfo in latestPluginList) + foreach (var plugin in plugins) + if (plugin.Name == latestPluginInfo.Name && plugin.Version != latestPluginInfo.Version) + pluginUpdateList.Add(new PluginUpdateInfo(plugin.Name, plugin.Author, latestPluginInfo.Version, plugin.Version, plugin.Path, latestPluginInfo.Path)); + return pluginUpdateList; + } + + private static List GetUpdates(List latestPluginList) + { + List pluginUpdateList = new(); + var plugins = GetPlugins(); + foreach (var latestPluginInfo in latestPluginList) + foreach (var plugin in plugins) + if (plugin.Name == latestPluginInfo.Name && plugin.Version != latestPluginInfo.Version) + pluginUpdateList.Add(new PluginUpdateInfo(plugin.Name, plugin.Author, latestPluginInfo.Version, plugin.Version, plugin.Path, latestPluginInfo.Path)); + return pluginUpdateList; + } + + private static List GetRepoPlugin() + { + var plugins = GetPlugins(); + HttpClient httpClient = new(); + var response = httpClient.GetAsync(PUrl + PluginsUrl).Result; + + if (!response.IsSuccessStatusCode) + throw new Exception("无法连接服务器"); + var json = response.Content.ReadAsStringAsync().Result; + return JsonConvert.DeserializeObject>(json) ?? new(); + } + + private static List GetPlugins() + { + List plugins = new(); + //获取已安装的插件,并且读取插件信息和AssemblyName + foreach (var plugin in ServerApi.Plugins) + { + plugins.Add(new PluginVersionInfo() + { + AssemblyName = plugin.Plugin.GetType().Assembly.GetName().Name!, + Author = plugin.Plugin.Author, + Name = plugin.Plugin.Name, + Description = plugin.Plugin.Description, + Version = plugin.Plugin.Version.ToString() + }); + } + //反射拯救了TSAPI + var type = typeof(ServerApi); + var field = type.GetField("loadedAssemblies", BindingFlags.NonPublic | BindingFlags.Static)!; + if (field.GetValue(null) is Dictionary loadedAssemblies) + foreach (var (fileName, assembly) in loadedAssemblies) + for (int i = 0; i < plugins.Count; i++) + if (plugins[i].AssemblyName == assembly.GetName().Name) + plugins[i].Path = fileName + ".dll"; + return plugins; + } + + + private static void DownLoadPlugin() + { + DirectoryInfo directoryInfo = new(TempSaveDir); + if (!directoryInfo.Exists) + directoryInfo.Create(); + HttpClient httpClient = new(); + var zipBytes = httpClient.GetByteArrayAsync(PUrl + ReleaseUrl).Result; + File.WriteAllBytes(Path.Combine(directoryInfo.FullName, TempZipName), zipBytes); + } + + private static void ExtractDirectoryZip() + { + DirectoryInfo directoryInfo = new(TempSaveDir); + ZipFile.ExtractToDirectory(Path.Combine(directoryInfo.FullName, TempZipName), Path.Combine(directoryInfo.FullName, "Plugins"), true); + } + + private static void InstallPlugin(List plugininfos) + { + foreach (var info in plugininfos) + { + string sourcePath = Path.Combine(TempSaveDir, "Plugins", info.Path); + string destinationPath = Path.Combine(ServerApi.ServerPluginsDirectoryPath, info.Path); + File.Copy(sourcePath, destinationPath, true); + //热添加插件emmm + //var ass = Assembly.Load(File.ReadAllBytes(destinationPath)); + } + if (Directory.Exists(TempSaveDir)) + Directory.Delete(TempSaveDir, true); + } + + private static List UpdatePlugin(List pluginUpdateInfos) + { + for (int i = pluginUpdateInfos.Count - 1; i >= 0; i--) + { + var pluginUpdateInfo = pluginUpdateInfos[i]; + string sourcePath = Path.Combine(TempSaveDir, "Plugins", pluginUpdateInfo.RemotePath); + string destinationPath = Path.Combine(ServerApi.ServerPluginsDirectoryPath, pluginUpdateInfo.LocalPath); + // 确保目标目录存在 + string destinationDirectory = Path.GetDirectoryName(destinationPath)!; + if (File.Exists(destinationPath)) + { + File.Copy(sourcePath, destinationPath, true); + } + else + { + TShock.Log.ConsoleWarn($"[跳过更新]无法在本地找到插件{pluginUpdateInfo.Name}({destinationPath}),可能是云加载或使用-additionalplugins加载"); + pluginUpdateInfos.RemoveAt(i); // 移除元素 + } + } + if (Directory.Exists(TempSaveDir)) + Directory.Delete(TempSaveDir, true); + + return pluginUpdateInfos; + } + #endregion +} diff --git a/AutoUpdatePlugin/PluginUpdateInfo.cs b/AutoPluginManager/PluginUpdateInfo.cs similarity index 94% rename from AutoUpdatePlugin/PluginUpdateInfo.cs rename to AutoPluginManager/PluginUpdateInfo.cs index 9938f5662..713f5ebc6 100644 --- a/AutoUpdatePlugin/PluginUpdateInfo.cs +++ b/AutoPluginManager/PluginUpdateInfo.cs @@ -1,4 +1,4 @@ -namespace AutoUpdatePlugin; +namespace AutoPluginManager; public class PluginUpdateInfo { diff --git a/AutoUpdatePlugin/PluginVersionInfo.cs b/AutoPluginManager/PluginVersionInfo.cs similarity index 92% rename from AutoUpdatePlugin/PluginVersionInfo.cs rename to AutoPluginManager/PluginVersionInfo.cs index e0ffe5bc0..651502a15 100644 --- a/AutoUpdatePlugin/PluginVersionInfo.cs +++ b/AutoPluginManager/PluginVersionInfo.cs @@ -1,4 +1,4 @@ -namespace AutoUpdatePlugin; +namespace AutoPluginManager; public class PluginVersionInfo { diff --git a/AutoPluginManager/README.md b/AutoPluginManager/README.md new file mode 100644 index 000000000..4f0b6500a --- /dev/null +++ b/AutoPluginManager/README.md @@ -0,0 +1,31 @@ +# PluginManager 自动更新插件 + +- 作者: 少司命,Cai +- 出处: 本仓库 +- 使用指令自动更新服务器的插件(仅本仓库) + +## 更新日志 + +``` +V2.0.0.0 +1.正式更名为AutoPluginManager +2.添加安装插件功能 +3.更改指令使用方式 +``` + +## 指令 + +| 语法 | 权限 | 说明 | +| -------------- | :-----------------: | :------: | +| /apm -c | AutoUpdatePlugin | 检查插件更新| +| /apm -u [插件名] | AutoUpdatePlugin | 一键升级插件,需要重启服务器,插件名可多选`英文逗号隔开o`| +| /apm -l | AutoUpdatePlugin | 查看仓库插件列表 | +| /apm -i [插件序号] | AutoUpdatePlugin | 安装插件,需重启服务器,插件序号多选`英文逗号隔开`配合`/apm -i``指令使用 | +## 配置 + +```json +暂无 +``` +## 反馈 +- 共同维护的插件库:https://github.com/Controllerdestiny/TShockPlugin +- 国内社区trhub.cn 或 TShock官方群等 \ No newline at end of file diff --git a/AutoUpdatePlugin/Plugin.cs b/AutoUpdatePlugin/Plugin.cs deleted file mode 100644 index d2db5c7d9..000000000 --- a/AutoUpdatePlugin/Plugin.cs +++ /dev/null @@ -1,231 +0,0 @@ -using Newtonsoft.Json; -using System.IO.Compression; -using System.Reflection; -using Terraria; -using TerrariaApi.Server; -using TShockAPI; - -namespace AutoUpdatePlugin; - -[ApiVersion(2, 1)] -public class Plugin : TerrariaPlugin -{ - public override string Name => "AutoUpdatePlugin"; - - public override Version Version => new(2024, 6, 21, 3); - - public override string Author => "少司命,Cai"; - - public override string Description => "自动更新你的插件!"; - - private const string ReleaseUrl = "https://github.com/Controllerdestiny/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip"; - - private const string PUrl = "https://github.moeyy.xyz/"; - - private const string PluginsUrl = "https://raw.githubusercontent.com/Controllerdestiny/TShockPlugin/master/Plugins.json"; - - private static readonly HttpClient _httpClient = new(); - - private const string TempSaveDir = "TempFile"; - - private const string TempZipName = "Plugins.zip"; - - private readonly System.Timers.Timer _timer = new(); - - public Plugin(Main game) : base(game) - { - - } - - public override void Initialize() - { - Commands.ChatCommands.Add(new("AutoUpdatePlugin", CheckCmd, "cplugin")); - Commands.ChatCommands.Add(new("AutoUpdatePlugin", UpdateCmd, "uplugin")); - ServerApi.Hooks.GamePostInitialize.Register(this, AutoCheckUpdate,int.MinValue); //最低优先级 - } - - protected override void Dispose(bool disposing) - { - if (disposing) - { - - ServerApi.Hooks.GamePostInitialize.Deregister(this, AutoCheckUpdate); - } - - base.Dispose(disposing); - } - - private void AutoCheckUpdate(EventArgs args) - { - _timer.AutoReset = true; - _timer.Enabled = true; - _timer.Interval = 60 * 30 * 1000; - _timer.Elapsed += (_, _) => - { - try - { - var updates = GetUpdate(); - if (updates.Any()) - { - TShock.Log.ConsoleInfo("[以下插件有新的版本更新]\n" + string.Join("\n", updates.Select(i => $"[{i.Name}] V{i.OldVersion} >>> V{i.NewVersion}"))); - TShock.Log.ConsoleInfo("你可以使用命令/uplugin更新插件哦~"); - } - - } - catch (Exception ex) - { - TShock.Log.ConsoleInfo("[AutoUpdate]无法获取更新:" + ex.Message); - return; - } - }; - _timer.Start(); - } - - private void UpdateCmd(CommandArgs args) - { - try - { - var updates = GetUpdate(); - if (updates.Count == 0) - { - args.Player.SendSuccessMessage("你的插件全是最新版本,无需更新哦~"); - return; - } - if (args.Parameters.Count == 2 && args.Parameters[0].ToLower() == "-t") - { - if (!updates.Any(x => x.Name == args.Parameters[1])) - { - args.Player.SendSuccessMessage("指定更新的插件: {0} 无需更新!", args.Parameters[1]); - return; - } - updates.RemoveAll(x => x.Name != args.Parameters[1]); - } - args.Player.SendInfoMessage("正在下载最新插件包..."); - DownLoadPlugin(); - args.Player.SendInfoMessage("正在解压插件包..."); - ExtractDirectoryZip(); - args.Player.SendInfoMessage("正在升级插件..."); - var success = UpdatePlugin(updates); - if (success.Count == 0) - { - args.Player.SendSuccessMessage("更新了个寂寞~"); - return; - } - args.Player.SendSuccessMessage("[更新完成]\n" + string.Join("\n", success.Select(i => $"[{i.Name}] V{i.OldVersion} >>> V{i.NewVersion}"))); - args.Player.SendSuccessMessage("重启服务器后插件生效!"); - } - catch (Exception ex) - { - args.Player.SendErrorMessage("自动更新出现错误:" + ex.Message); - return; - } - } - - private void CheckCmd(CommandArgs args) - { - try - { - var updates = GetUpdate(); - if (updates.Count == 0) - { - args.Player.SendSuccessMessage("你的插件全是最新版本,无需更新哦~"); - return; - } - args.Player.SendInfoMessage("[以下插件有新的版本更新]\n" + string.Join("\n", updates.Select(i => $"[{i.Name}] V{i.OldVersion} >>> V{i.NewVersion}"))); - } - catch (Exception ex) - { - args.Player.SendErrorMessage("无法获取更新:" + ex.Message); - return; - } - } - - #region 工具方法 - private static List GetUpdate() - { - var plugins = GetPlugins(); - HttpClient httpClient = new(); - var response = httpClient.GetAsync(PUrl + PluginsUrl).Result; - - if (!response.IsSuccessStatusCode) - throw new Exception("无法连接服务器"); - var json = response.Content.ReadAsStringAsync().Result; - var latestPluginList = JsonConvert.DeserializeObject>(json) ?? new(); - List pluginUpdateList = new(); - foreach (var latestPluginInfo in latestPluginList) - foreach (var plugin in plugins) - if (plugin.Name == latestPluginInfo.Name && plugin.Version != latestPluginInfo.Version) - pluginUpdateList.Add(new PluginUpdateInfo(plugin.Name, plugin.Author, latestPluginInfo.Version, plugin.Version, plugin.Path, latestPluginInfo.Path)); - return pluginUpdateList; - } - - private static List GetPlugins() - { - List plugins = new(); - //获取已安装的插件,并且读取插件信息和AssemblyName - foreach (var plugin in ServerApi.Plugins) - { - plugins.Add(new PluginVersionInfo() - { - AssemblyName = plugin.Plugin.GetType().Assembly.GetName().Name!, - Author = plugin.Plugin.Author, - Name = plugin.Plugin.Name, - Description = plugin.Plugin.Description, - Version = plugin.Plugin.Version.ToString() - }); - } - //反射拯救了TSAPI - var type = typeof(ServerApi); - var field = type.GetField("loadedAssemblies", BindingFlags.NonPublic | BindingFlags.Static)!; - if(field.GetValue(null) is Dictionary loadedAssemblies) - foreach (var (fileName, assembly) in loadedAssemblies) - for (int i = 0; i < plugins.Count; i++) - if (plugins[i].AssemblyName == assembly.GetName().Name) - plugins[i].Path = fileName + ".dll"; - return plugins; - } - - - private static void DownLoadPlugin() - { - DirectoryInfo directoryInfo = new(TempSaveDir); - if (!directoryInfo.Exists) - directoryInfo.Create(); - HttpClient httpClient = new(); - var zipBytes = httpClient.GetByteArrayAsync(PUrl + ReleaseUrl).Result; - File.WriteAllBytes(Path.Combine(directoryInfo.FullName, TempZipName), zipBytes); - } - - private static void ExtractDirectoryZip() - { - DirectoryInfo directoryInfo = new(TempSaveDir); - ZipFile.ExtractToDirectory(Path.Combine(directoryInfo.FullName, TempZipName), Path.Combine(directoryInfo.FullName, "Plugins"), true); - } - - private static List UpdatePlugin(List pluginUpdateInfos) - { - for (int i = pluginUpdateInfos.Count - 1; i >= 0; i--) - { - var pluginUpdateInfo = pluginUpdateInfos[i]; - string sourcePath = Path.Combine(TempSaveDir, "Plugins", pluginUpdateInfo.RemotePath); - string destinationPath = Path.Combine(ServerApi.ServerPluginsDirectoryPath, pluginUpdateInfo.LocalPath); - // 确保目标目录存在 - string destinationDirectory = Path.GetDirectoryName(destinationPath)!; - if (File.Exists(destinationPath)) - { - File.Copy(sourcePath, destinationPath, true); - } - else - { - TShock.Log.ConsoleWarn($"[跳过更新]无法在本地找到插件{pluginUpdateInfo.Name}({destinationPath}),可能是云加载或使用-additionalplugins加载"); - pluginUpdateInfos.RemoveAt(i); // 移除元素 - } - } - - if (Directory.Exists(TempSaveDir)) - Directory.Delete(TempSaveDir, true); - - return pluginUpdateInfos; - } - #endregion -} diff --git a/AutoUpdatePlugin/README.md b/AutoUpdatePlugin/README.md deleted file mode 100644 index 3791c8fc9..000000000 --- a/AutoUpdatePlugin/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# AutoUpdatePlugin 自动更新插件 - -- 作者: 少司命,Cai -- 出处: 本仓库 -- 使用指令自动更新服务器的插件(仅本仓库) - -## 更新日志 - -``` -1. 更新指定插件命令 -``` - -## 指令 - -| 语法 | 权限 | 说明 | -| -------------- | :-----------------: | :------: | -| /cplugin | AutoUpdatePlugin | 检查插件更新| -| /uplugin | AutoUpdatePlugin | 一键升级插件(需要重启服务器)| -| /uplugin -t [插件名] | AutoUpdatePlugin | 更新指定插件| -## 配置 - -```json -暂无 -``` -## 反馈 -- 共同维护的插件库:https://github.com/Controllerdestiny/TShockPlugin -- 国内社区trhub.cn 或 TShock官方群等 \ No newline at end of file diff --git a/Plugin.sln b/Plugin.sln index 1d81342bc..7beea3904 100644 --- a/Plugin.sln +++ b/Plugin.sln @@ -184,7 +184,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TimerKeeper", "TimerKeeper\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Chameleon", "Chameleon\Chameleon.csproj", "{53CD6498-27DE-4C8C-A706-3CD2BD106D9E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoUpdatePlugin", "AutoUpdatePlugin\AutoUpdatePlugin.csproj", "{9B88AC5E-E11C-4424-A5DC-5C1D094860B9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoPluginManager", "AutoPluginManager\AutoPluginManager.csproj", "{9A3AB28D-42A7-427F-9F76-2F8398570540}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -898,14 +898,14 @@ Global {53CD6498-27DE-4C8C-A706-3CD2BD106D9E}.Release|Any CPU.Build.0 = Release|Any CPU {53CD6498-27DE-4C8C-A706-3CD2BD106D9E}.Release|x64.ActiveCfg = Release|Any CPU {53CD6498-27DE-4C8C-A706-3CD2BD106D9E}.Release|x64.Build.0 = Release|Any CPU - {9B88AC5E-E11C-4424-A5DC-5C1D094860B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9B88AC5E-E11C-4424-A5DC-5C1D094860B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B88AC5E-E11C-4424-A5DC-5C1D094860B9}.Debug|x64.ActiveCfg = Debug|Any CPU - {9B88AC5E-E11C-4424-A5DC-5C1D094860B9}.Debug|x64.Build.0 = Debug|Any CPU - {9B88AC5E-E11C-4424-A5DC-5C1D094860B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9B88AC5E-E11C-4424-A5DC-5C1D094860B9}.Release|Any CPU.Build.0 = Release|Any CPU - {9B88AC5E-E11C-4424-A5DC-5C1D094860B9}.Release|x64.ActiveCfg = Release|Any CPU - {9B88AC5E-E11C-4424-A5DC-5C1D094860B9}.Release|x64.Build.0 = Release|Any CPU + {9A3AB28D-42A7-427F-9F76-2F8398570540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A3AB28D-42A7-427F-9F76-2F8398570540}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A3AB28D-42A7-427F-9F76-2F8398570540}.Debug|x64.ActiveCfg = Debug|Any CPU + {9A3AB28D-42A7-427F-9F76-2F8398570540}.Debug|x64.Build.0 = Debug|Any CPU + {9A3AB28D-42A7-427F-9F76-2F8398570540}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A3AB28D-42A7-427F-9F76-2F8398570540}.Release|Any CPU.Build.0 = Release|Any CPU + {9A3AB28D-42A7-427F-9F76-2F8398570540}.Release|x64.ActiveCfg = Release|Any CPU + {9A3AB28D-42A7-427F-9F76-2F8398570540}.Release|x64.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index c133c6154..c9d1c574d 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ | [Musicplayer](Musicplayer/README.md) | 简易音乐播放器 | 无 | | [TimerKeeper](TimerKeeper/README.md) | 保存计时器状态 | 无 | | [Chameleon](Chameleon/README.md) | 进服前登录 | 无 | -| [AutoUpdatePlugin](AutoUpdatePlugin/README.md) | 一键自动更新插件 | 无 | +| [AutoPluginManager](AutoPluginManager/README.md) | 一键自动更新插件 | 无 | ## 代码贡献 From a05379b924b26b6275abb502a9230e3fa37ec32d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=91=E5=8F=B8=E5=91=BD?= <79201070+Controllerdestiny@users.noreply.github.com> Date: Sun, 23 Jun 2024 20:13:51 +0800 Subject: [PATCH 2/3] Update README.md --- AutoPluginManager/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AutoPluginManager/README.md b/AutoPluginManager/README.md index 4f0b6500a..2b7fc004a 100644 --- a/AutoPluginManager/README.md +++ b/AutoPluginManager/README.md @@ -18,7 +18,7 @@ V2.0.0.0 | 语法 | 权限 | 说明 | | -------------- | :-----------------: | :------: | | /apm -c | AutoUpdatePlugin | 检查插件更新| -| /apm -u [插件名] | AutoUpdatePlugin | 一键升级插件,需要重启服务器,插件名可多选`英文逗号隔开o`| +| /apm -u [插件名] | AutoUpdatePlugin | 一键升级插件,需要重启服务器,插件名可多选`英文逗号隔开`| | /apm -l | AutoUpdatePlugin | 查看仓库插件列表 | | /apm -i [插件序号] | AutoUpdatePlugin | 安装插件,需重启服务器,插件序号多选`英文逗号隔开`配合`/apm -i``指令使用 | ## 配置 @@ -28,4 +28,4 @@ V2.0.0.0 ``` ## 反馈 - 共同维护的插件库:https://github.com/Controllerdestiny/TShockPlugin -- 国内社区trhub.cn 或 TShock官方群等 \ No newline at end of file +- 国内社区trhub.cn 或 TShock官方群等 From 6e6cb4a70fb414f9ab47fc86d23c23f7d35b75f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=91=E5=8F=B8=E5=91=BD?= <79201070+Controllerdestiny@users.noreply.github.com> Date: Sun, 23 Jun 2024 20:15:14 +0800 Subject: [PATCH 3/3] Update README.md --- AutoPluginManager/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutoPluginManager/README.md b/AutoPluginManager/README.md index 2b7fc004a..fa1fa1933 100644 --- a/AutoPluginManager/README.md +++ b/AutoPluginManager/README.md @@ -20,7 +20,7 @@ V2.0.0.0 | /apm -c | AutoUpdatePlugin | 检查插件更新| | /apm -u [插件名] | AutoUpdatePlugin | 一键升级插件,需要重启服务器,插件名可多选`英文逗号隔开`| | /apm -l | AutoUpdatePlugin | 查看仓库插件列表 | -| /apm -i [插件序号] | AutoUpdatePlugin | 安装插件,需重启服务器,插件序号多选`英文逗号隔开`配合`/apm -i``指令使用 | +| /apm -i [插件序号] | AutoUpdatePlugin | 安装插件,需重启服务器,插件序号多选`英文逗号隔开`配合`/apm -i`指令使用 | ## 配置 ```json