Fix examples.

Fix Die event trigger incorrectly issue.
This commit is contained in:
Tnze
2021-02-18 17:42:19 +08:00
parent d6b5accdc8
commit 67a7b42a01
4 changed files with 12 additions and 5 deletions

View File

@ -25,7 +25,7 @@ func ExampleClient_JoinServer_offline() {
c.Auth.UUID = hex.EncodeToString(id[:])
//Login
err := c.JoinServer("localhost", 25565)
err := c.JoinServer("127.0.0.1")
if err != nil {
log.Fatal(err)
}
@ -57,7 +57,7 @@ func ExampleClient_JoinServer_online() {
c.AsTk = auth.AccessToken()
//Connect server
err = c.JoinServer("localhost", 25565)
err = c.JoinServer("127.0.0.1")
if err != nil {
log.Fatal(err)
}

View File

@ -460,7 +460,7 @@ func handleUpdateHealthPacket(c *Client, p pk.Packet) error {
return err
}
}
if c.Health < 1 { //player is dead
if c.Health <= 0 { //player is dead
c.Physics.Run = false
sendPlayerPositionAndLookPacket(c)
if c.Events.Die != nil {