Removed Timers for Cooldowns for Items.

This commit is contained in:
2021-04-22 19:51:52 +02:00
parent c77c078141
commit 3b04a0776e
3 changed files with 20 additions and 33 deletions

View File

@@ -11,9 +11,7 @@ namespace ReallifeGamemode.Server.Util
{
private readonly Player player;
private readonly Vehicle veh;
private readonly IUsableItem usableItem;
private readonly Timer timer;
public readonly DateTime startTime;
public delegate void PlayerTimerElapsed(Player player, dynamic dynamic);
@@ -29,23 +27,10 @@ namespace ReallifeGamemode.Server.Util
this.timer.Start();
}
public PlayerTimer(Player player, IUsableItem usableItem, float milliseconds = 1000)
{
this.player = player;
this.usableItem = usableItem;
this.startTime = DateTime.Now.AddMilliseconds(milliseconds);
this.timer = new Timer(milliseconds);
this.timer.Elapsed += Timer_Elapsed;
this.timer.Start();
}
private void Timer_Elapsed(object sender, ElapsedEventArgs e)
{
if (veh != null)
Elapsed?.Invoke(player, veh);
else
Elapsed?.Invoke(player, usableItem);
}
public void Stop()