Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复: Autoclear的几个问题 #133

Merged
merged 3 commits into from
May 19, 2024
Merged
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
10 changes: 3 additions & 7 deletions Autoclear/Autoclear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class Autoclear : TerrariaPlugin
public static Configuration Config;
private bool _sweepScheduled = false;
private DateTime _sweepScheduledAt;
private int _updateCounter;
private long _updateCounter;

public Autoclear(Main game) : base(game)
{
Expand Down Expand Up @@ -44,6 +44,7 @@ protected override void Dispose(bool disposing)
{
if (disposing)
{
GeneralHooks.ReloadEvent -= ReloadConfig;
ServerApi.Hooks.GameUpdate.Deregister(this, OnUpdate);
}
base.Dispose(disposing);
Expand All @@ -70,12 +71,7 @@ private void OnUpdate(EventArgs args)
{
_sweepScheduled = true;
_sweepScheduledAt = DateTime.UtcNow.AddSeconds(Config.DelayedSweepTimeoutSeconds);

// 发送倒计时消息
if (Config.SpecificMessage)
{
TSPlayer.All.SendSuccessMessage($"{Config.DelayedSweepCustomMessage}");
}
TSPlayer.All.SendSuccessMessage($"{Config.DelayedSweepCustomMessage}");
}
}
if (_sweepScheduled && DateTime.UtcNow >= _sweepScheduledAt)
Expand Down
Loading