Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AutoPluginManager/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ public static void Read()
return result;
}
[JsonProperty("允许自动更新插件")] public bool AutoUpdate = false;
[JsonProperty("使用Github源")] public bool UseGithubSource = false;
[JsonProperty("插件排除列表")] public List<string> UpdateBlackList = new();
}
16 changes: 9 additions & 7 deletions AutoPluginManager/Plugin.cs
Comment thread
ACaiCat marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ public class Plugin : TerrariaPlugin
{
public override string Name => "AutoPluginManager";

public override Version Version => new(2, 0, 1, 1);
public override Version Version => new(2, 0, 1, 3);

public override string Author => "少司命,Cai";

public override string Description => "自动更新你的插件!";

private const string ReleaseUrl = "https://github.com/UnrealMultiple/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip";

private const string PUrl = "https://github.moeyy.xyz/";
private const string GiteeReleaseUrl = "https://gitee.com/kksjsj/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip";
private const string GithubReleaseUrl = "https://github.com/UnrealMultiple/TShockPlugin/releases/download/V1.0.0.0/Plugins.zip";

private const string PluginsUrl = "https://raw.githubusercontent.com/UnrealMultiple/TShockPlugin/master/Plugins.json";
private const string GiteePluginsUrl = "https://gitee.com/kksjsj/TShockPlugin/raw/master/Plugins.json";

private const string GithubPluginsUrl = "https://raw.githubusercontent.com/UnrealMultiple/TShockPlugin/master/Plugins.json";

public static readonly Dictionary<string,Version> HasUpdated = new();

Expand Down Expand Up @@ -302,7 +304,7 @@ private static List<PluginVersionInfo> GetRepoPlugin()
{
var plugins = GetPlugins();
HttpClient httpClient = new();
var response = httpClient.GetAsync(PUrl + PluginsUrl).Result;
var response = httpClient.GetAsync(Config.PluginConfig.UseGithubSource?GithubPluginsUrl:GiteePluginsUrl).Result;

if (!response.IsSuccessStatusCode)
throw new Exception("无法连接服务器");
Expand Down Expand Up @@ -345,7 +347,7 @@ private static void DownLoadPlugin()
if (!directoryInfo.Exists)
directoryInfo.Create();
HttpClient httpClient = new();
var zipBytes = httpClient.GetByteArrayAsync(PUrl + ReleaseUrl).Result;
var zipBytes = httpClient.GetByteArrayAsync(Config.PluginConfig.UseGithubSource?GithubReleaseUrl:GiteeReleaseUrl).Result;
File.WriteAllBytes(Path.Combine(directoryInfo.FullName, TempZipName), zipBytes);
}

Expand Down
4 changes: 4 additions & 0 deletions AutoPluginManager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
## 更新日志

```
v2.0.1.3
添加配置项可切换到Github源
v2.0.1.2
将源更换为gitee
v2.0.1.1
更新: apm u支持排除插件,支持自动更新插件,apm l优化显示 & 修复: 插件更新回旧版本,更新插件后不重启仍提示更新
v2.0.0.3
Expand Down
5 changes: 3 additions & 2 deletions Challenger/Challenger/Challenger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Challenger : TerrariaPlugin

public override string Name => "Challenger";

public override Version Version => new Version(1, 0, 1, 3);
public override Version Version => new Version(1, 0, 1, 4);

public Challenger(Main game)
: base(game)
Expand Down Expand Up @@ -1438,14 +1438,15 @@ private void OnServerLeave(LeaveEventArgs args)
Collect.cprojs[i].CKill();
}
}
Collect.cplayers[args.Who].isActive = false;
}
}
catch (Exception ex)
{
Console.WriteLine("Challenger.OnServerLeave异常3:" + ex.Message);
TShock.Log.Error("Challenger.OnServerLeave异常3:" + ex.Message);
}
Collect.cplayers[args.Who].isActive = false;

}

private void OnGameUpdate(EventArgs args)
Expand Down
3 changes: 3 additions & 0 deletions Challenger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@

```
更新日志
1.1.4
修复ServerLeave Null报错

1.1.3
补全卸载函数

Expand Down