From cd353c27a30d80b807dc277264ff67782582bf54 Mon Sep 17 00:00:00 2001 From: White Date: Mon, 6 Apr 2015 11:59:47 +0930 Subject: [PATCH] Time parameter for tempgroup --- TShockAPI/TSPlayer.cs | 9 +++++++++ TShockAPI/TShock.cs | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs index 7f9fbced..85a2a689 100755 --- a/TShockAPI/TSPlayer.cs +++ b/TShockAPI/TSPlayer.cs @@ -22,9 +22,11 @@ using System.Diagnostics; using System.IO; using System.Text; using System.Threading; +using System.Timers; using Terraria; using TShockAPI.DB; using TShockAPI.Net; +using Timer = System.Timers.Timer; namespace TShockAPI { @@ -111,6 +113,8 @@ namespace TShockAPI /// The player's temporary group. This overrides the user's actual group. /// public Group tempGroup = null; + + public Timer tempGroupTimer; private Group group = null; @@ -523,6 +527,11 @@ namespace TShockAPI } + public void TempGroupTimerElapsed(object sender, ElapsedEventArgs args) + { + tempGroup = null; + } + public void SendWorldInfo(int tilex, int tiley, bool fakeid) { using (var ms = new MemoryStream()) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index d2440381..3b039acc 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -1022,6 +1022,11 @@ namespace TShockAPI { RememberedPos.InsertLeavePos(tsplr.Name, tsplr.IP, (int) (tsplr.X/16), (int) (tsplr.Y/16)); } + + if (tsplr.tempGroupTimer != null) + { + tsplr.tempGroupTimer.Stop(); + } } // The last player will leave after this hook is executed.