Fix examples.
Fix Die event trigger incorrectly issue.
This commit is contained in:
@ -24,7 +24,7 @@ func main() {
|
||||
c = bot.NewClient()
|
||||
|
||||
//Login
|
||||
err := c.JoinServer("localhost", 25565)
|
||||
err := c.JoinServer("127.0.0.1")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -14,10 +14,11 @@ import (
|
||||
)
|
||||
|
||||
var address = flag.String("address", "127.0.0.1", "The server address")
|
||||
var c *bot.Client
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
c := bot.NewClient()
|
||||
c = bot.NewClient()
|
||||
|
||||
//Login
|
||||
err := c.JoinServer(*address)
|
||||
@ -39,6 +40,12 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func onDeath() error {
|
||||
log.Println("Died and Respawned")
|
||||
// If we exclude Respawn(...) then the player won't press the "Respawn" button upon death
|
||||
return c.Respawn()
|
||||
}
|
||||
|
||||
func onGameStart() error {
|
||||
log.Println("Game start")
|
||||
return nil //if err isn't nil, HandleGame() will return it.
|
||||
|
Reference in New Issue
Block a user