From c31f1a002b3ee1056d2c3c69334ef7eab34b2f31 Mon Sep 17 00:00:00 2001 From: Distortions81 Date: Sat, 23 Mar 2024 23:07:20 -0600 Subject: [PATCH] quit if players hits 0 --- support/supportUtil.go | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/support/supportUtil.go b/support/supportUtil.go index 799b578d..af4017a4 100755 --- a/support/supportUtil.go +++ b/support/supportUtil.go @@ -33,22 +33,20 @@ func checkHours() { shutTime := time.Now() shutTime = shutTime.Add(time.Minute * 10) - if fact.NumPlayers > 0 { - for { - if time.Until(shutTime) <= time.Second { - break - } - if WithinHours() { - buf := fmt.Sprintf("Time was adjusted to %v - %v GMT, shutdown timer aborted.", - cfg.Local.Options.PlayStartHour, - cfg.Local.Options.PlayEndHour) - - fact.FactChat(buf) - fact.CMS(cfg.Local.Channel.ChatChannel, buf) - return - } - time.Sleep(time.Second) + for fact.NumPlayers > 0 { + if time.Until(shutTime) <= time.Second { + break } + if WithinHours() { + buf := fmt.Sprintf("Time was adjusted to %v - %v GMT, shutdown timer aborted.", + cfg.Local.Options.PlayStartHour, + cfg.Local.Options.PlayEndHour) + + fact.FactChat(buf) + fact.CMS(cfg.Local.Channel.ChatChannel, buf) + return + } + time.Sleep(time.Second) } if !WithinHours() {