test
This commit is contained in:
parent
9796ec9a47
commit
b441028e15
18
main.go
18
main.go
@ -24,6 +24,7 @@ var (
|
||||
clients map[uint32]*Client
|
||||
paused bool = true
|
||||
forcePaused bool = true
|
||||
forcePausedBy string
|
||||
|
||||
githash string
|
||||
buildstamp string
|
||||
@ -203,11 +204,11 @@ func main() {
|
||||
if sp.Message == "!unpause" {
|
||||
logInfoDebug("AdminPacketServerChat : Unpausing")
|
||||
forcePaused = false
|
||||
sendChat(-436055948, fmt.Sprintf("Game unpaused by %s", clients[sp.ClientID].Name))
|
||||
forcePausedBy = clients[sp.ClientID].Name
|
||||
} else if sp.Message == "!pause" {
|
||||
logInfoDebug("AdminPacketServerChat : Pausing")
|
||||
forcePaused = true
|
||||
sendChat(-436055948, fmt.Sprintf("Game paused by %s", clients[sp.ClientID].Name))
|
||||
forcePausedBy = clients[sp.ClientID].Name
|
||||
} else {
|
||||
logInfoDebug("AdminPacketServerChat :\n- ActionID: %d\n- DestinationID: %d\n- ClientID: %d\n- Message: %s\n- Amount: %d", sp.ActionID, sp.DestinationID, sp.ClientID, sp.Message, sp.Amount)
|
||||
}
|
||||
@ -282,6 +283,11 @@ func main() {
|
||||
Command: "pause",
|
||||
}
|
||||
_, err = conn.Write(px.Bytes())
|
||||
logInfoDebug("Force pausing")
|
||||
if pausedBy != "" {
|
||||
sendChat(-436055948, fmt.Sprintf("Game paused by %s", pausedBy))
|
||||
pausedBy = ""
|
||||
}
|
||||
}
|
||||
if paused && !forcePaused && len(clients) > 1 { // server is client #1
|
||||
paused = false
|
||||
@ -290,7 +296,11 @@ func main() {
|
||||
Command: "unpause",
|
||||
}
|
||||
_, err = conn.Write(px.Bytes())
|
||||
sendChat(-436055948, "Game unpaused.")
|
||||
logInfoDebug("Force unpausing")
|
||||
if pausedBy != "" {
|
||||
sendChat(-436055948, fmt.Sprintf("Game unpaused by %s", pausedBy))
|
||||
pausedBy = ""
|
||||
}
|
||||
}
|
||||
if !paused && len(clients) == 1 { // server is client #1
|
||||
paused = true
|
||||
@ -300,6 +310,8 @@ func main() {
|
||||
}
|
||||
_, err = conn.Write(px.Bytes())
|
||||
logInfoDebug("Pausing")
|
||||
sendChat(-436055948, "No players. Game paused.")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user