minor improvements and changes
Signed-off-by: Michael <michael.lindman@gmail.com>
This commit is contained in:
parent
049ab265d3
commit
20478e3c1f
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
mcstatus
|
||||
mcstatus.exe
|
||||
run.sh
|
||||
go.sum
|
2
Makefile
2
Makefile
@ -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
18
main.go
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user