From 1b87098d8c5a5cdf932115c4ac3dbb00f4618bcf Mon Sep 17 00:00:00 2001 From: Controllerdestiny <523321293@qq.com> Date: Mon, 6 May 2024 12:46:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E6=AD=BB=E4=BA=A1=E6=97=B6=E9=80=80=E5=87=BA=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E6=92=AD=E6=8A=A5=E6=AD=BB=E4=BA=A1=E5=80=92?= =?UTF-8?q?=E8=AE=A1=E6=97=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ServerTools/Plugin.Online.cs | 6 +++++- ServerTools/Plugin.cs | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ServerTools/Plugin.Online.cs b/ServerTools/Plugin.Online.cs index b6c9fdeb2..e81f94a6d 100644 --- a/ServerTools/Plugin.Online.cs +++ b/ServerTools/Plugin.Online.cs @@ -26,8 +26,12 @@ private void _OnLeave(LeaveEventArgs args) private void OnGreet(GreetPlayerEventArgs args) { var ply = TShock.Players[args.Who]; - if(ply != null) + if (ply != null) + { ActivePlayers.Add(ply); + ply.RespawnTimer = 0; + } + } private void OnUpdatePlayerOnline(EventArgs args) diff --git a/ServerTools/Plugin.cs b/ServerTools/Plugin.cs index 559eb4002..4a145c6d5 100644 --- a/ServerTools/Plugin.cs +++ b/ServerTools/Plugin.cs @@ -1,5 +1,4 @@ using MonoMod.RuntimeDetour; -using System.ComponentModel; using Terraria; using Terraria.GameContent.Creative; using TerrariaApi.Server; @@ -56,6 +55,7 @@ public override void Initialize() #region 指令 Commands.ChatCommands.Add(new Command(Permissions.clear, Clear, "clp")); + Commands.ChatCommands.Add(new Command("servertool.query.exit", Exit, "退出")); Commands.ChatCommands.Add(new Command("servertool.query.wall", WallQ, "查花苞")); Commands.ChatCommands.Add(new Command("servertool.query.wall", RWall, "移除花苞")); Commands.ChatCommands.Add(new Command("servertool.user.kick", SelfKick, "自踢")); @@ -83,6 +83,11 @@ public override void Initialize() HandleCommandLine(Environment.GetCommandLineArgs()); } + private void Exit(CommandArgs args) + { + args.Player.SendData(PacketTypes.ChestOpen, "", args.Player.Index, -1); + } + public static bool CommandHook(TSPlayer ply, string cmd) { CmdHook.Undo(); @@ -167,6 +172,7 @@ private void OnLeave(LeaveEventArgs args) var ply = TShock.Players[args.Who]; if (ply == null) return; + Deads.Remove(ply); if (ply.Dead) PlayerDeath[ply.Name] = DateTime.Now.AddSeconds(ply.RespawnTimer); }