test
This commit is contained in:
parent
9b5845a163
commit
9796ec9a47
10
main.go
10
main.go
@ -163,6 +163,7 @@ func main() {
|
||||
}
|
||||
sp.Read(b[:p.PLength])
|
||||
logInfoDebug("AdminPacketServerClientJoin :\n- ClientID: %d", sp.ClientID)
|
||||
sendChat(-436055948, fmt.Sprintf("%s joining.", clients[sp.ClientID].Name))
|
||||
case AdminPacketServerClientInfo:
|
||||
sp := PacketServerClientInfo{
|
||||
Packet: p,
|
||||
@ -189,6 +190,9 @@ func main() {
|
||||
}
|
||||
sp.Read(b[:p.PLength])
|
||||
logInfoDebug("AdminPacketServerClientQuit :\n- ClientID: %d", sp.ClientID)
|
||||
if len(clients) == 2 && !paused {
|
||||
sendChat(-436055948, fmt.Sprintf("%s leaving. Game paused.", clients[sp.ClientID].Name))
|
||||
}
|
||||
delete(clients, sp.ClientID)
|
||||
case AdminPacketServerChat:
|
||||
sp := PacketServerChat{
|
||||
@ -278,8 +282,6 @@ func main() {
|
||||
Command: "pause",
|
||||
}
|
||||
_, err = conn.Write(px.Bytes())
|
||||
logInfoDebug("Pause forced")
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
if paused && !forcePaused && len(clients) > 1 { // server is client #1
|
||||
paused = false
|
||||
@ -288,8 +290,7 @@ func main() {
|
||||
Command: "unpause",
|
||||
}
|
||||
_, err = conn.Write(px.Bytes())
|
||||
logInfoDebug("Unpause forced")
|
||||
time.Sleep(1 * time.Second)
|
||||
sendChat(-436055948, "Game unpaused.")
|
||||
}
|
||||
if !paused && len(clients) == 1 { // server is client #1
|
||||
paused = true
|
||||
@ -299,7 +300,6 @@ func main() {
|
||||
}
|
||||
_, err = conn.Write(px.Bytes())
|
||||
logInfoDebug("Pausing")
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user