minor improvements and changes

Signed-off-by: Michael <michael.lindman@gmail.com>
This commit is contained in:
Michael 2021-01-08 15:55:40 +00:00
parent 049ab265d3
commit 20478e3c1f
3 changed files with 17 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
mcstatus
mcstatus.exe
run.sh
go.sum

View File

@ -22,6 +22,6 @@ clean:
go clean
proto:
protoc --go_out=/home/michael/go/src response.proto
protoc --go_out=/home/michael/go/src protobuf/*.proto
.PHONY: run doc build debs update-debs fmt proto

18
main.go
View File

@ -28,7 +28,11 @@ func run() error {
return err
}
if cmd.ping {
fmt.Printf("Ping: %+v\n", client.PingServer())
ping, err := client.PingServer()
if err != nil {
return err
}
fmt.Printf("Ping: %+v\n", ping)
return nil
}
if cmd.raw {
@ -39,8 +43,12 @@ func run() error {
fmt.Printf("%s\n", string(json))
return nil
}
name := status.Description.Text
if name == "" {
name = status.Description.Extra[0].Text
}
fmt.Printf("Name: %s\nPlayers: %d/%d\nVersion: %s\n",
status.Description.Text,
name,
status.Players.Online,
status.Players.Max,
status.Version.Name)
@ -50,7 +58,11 @@ func run() error {
fmt.Printf("\t%s\n", player.Name)
}
}
fmt.Printf("Ping: %+v\n", client.PingServer())
ping, err := client.PingServer()
if err != nil {
return err
}
fmt.Printf("Ping: %+v\n", ping)
return nil
}
}