Move to event loop, prettify warps, add delay to warp with damage counter
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Tyler
2021-06-12 01:28:34 -04:00
parent c037c66fc6
commit f9512b2485
12 changed files with 528 additions and 86 deletions

View File

@ -3,8 +3,8 @@ package rcon
import (
"encoding/json"
"fmt"
log "github.com/sirupsen/logrus"
"github.com/tystuyfzand/mcgorcon"
"log"
"time"
)
@ -68,15 +68,16 @@ func (r *Session) openConnection() *mcgorcon.Client {
<-time.After(10 * time.Second)
}
log.Println("Connection opened")
log.WithFields(log.Fields{
"host": r.host,
"port": r.port,
}).Info("Connection opened")
return c
}
func (r *Session) SendCommand(command string) (string, error) {
if r.Debug {
log.Println("Send command: " + command)
}
log.WithField("command", command).Debug("Sending command")
return r.connection().SendCommand(command)
}