diff --git a/src/ServerTools/Config.cs b/src/ServerTools/Config.cs index 660636206..2215790fd 100644 --- a/src/ServerTools/Config.cs +++ b/src/ServerTools/Config.cs @@ -11,6 +11,9 @@ public class Config [JsonProperty("限制哨兵数量")] public int sentryLimit = 10; + [JsonProperty("限制召唤物数量")] + public int summonLimit = 10; + [JsonProperty("仅允许软核进入")] public bool OnlySoftCoresAreAllowed = false; diff --git a/src/ServerTools/Plugin.cs b/src/ServerTools/Plugin.cs index 3c8a063e5..e66849ab4 100644 --- a/src/ServerTools/Plugin.cs +++ b/src/ServerTools/Plugin.cs @@ -20,7 +20,7 @@ public partial class Plugin : TerrariaPlugin public override string Name => "ServerTools";// 插件名字 - public override Version Version => new(1, 1, 7, 4);// 插件版本 + public override Version Version => new(1, 1, 7, 5);// 插件版本 private static Config Config = new(); @@ -387,10 +387,21 @@ private void NewProj(object? sender, GetDataHandlers.NewProjectileEventArgs e) { if (Main.projectile[e.Index].sentry) { - if (Main.projectile.Where(x => x.owner == e.Owner).Count() > Config.sentryLimit) + if (Main.projectile.Where(x => x != null && x.owner == e.Owner && x.sentry && x.active).Count() > Config.sentryLimit) { Main.projectile[e.Index].active = false; e.Handled = true; + TSPlayer.All.SendData(PacketTypes.ProjectileNew, "", e.Index); + return; + } + } + if (Main.projectile[e.Index].minion) + { + if (Main.projectile.Where(x => x != null && x.owner == e.Owner && x.minion && x.active).Count() > Config.summonLimit) + { + Main.projectile[e.Index].active = false; + e.Handled = true; + TSPlayer.All.SendData(PacketTypes.ProjectileNew, "", e.Index); return; } } diff --git a/src/ServerTools/README.md b/src/ServerTools/README.md index e3a5539f5..095eb717c 100644 --- a/src/ServerTools/README.md +++ b/src/ServerTools/README.md @@ -7,6 +7,9 @@ ## 更新日志 ``` +V1.1.7.5 +添加配置限制召唤物数量 + v1.1.7.4 完善卸载函数