Skip to content

Commit

Permalink
quit if players hits 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Distortions81 committed Mar 24, 2024
1 parent 69fccc1 commit c31f1a0
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions support/supportUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit c31f1a0

Please sign in to comment.