diff --git a/bot/event.go b/bot/event.go index d3ba7dc..a63593c 100644 --- a/bot/event.go +++ b/bot/event.go @@ -3,13 +3,14 @@ package bot import ( "github.com/Tnze/go-mc/bot/world/entity" "github.com/Tnze/go-mc/chat" + "github.com/google/uuid" pk "github.com/Tnze/go-mc/net/packet" ) type eventBroker struct { GameStart func() error - ChatMsg func(msg chat.Message, pos byte, sender string) error + ChatMsg func(msg chat.Message, pos byte, sender uuid.UUID) error Disconnect func(reason chat.Message) error HealthChange func() error Die func() error diff --git a/bot/ingame.go b/bot/ingame.go index 39b44c9..ec97122 100644 --- a/bot/ingame.go +++ b/bot/ingame.go @@ -4,6 +4,7 @@ import ( "bytes" "errors" "fmt" + "github.com/google/uuid" "io/ioutil" "github.com/Tnze/go-mc/bot/world" @@ -285,7 +286,7 @@ func handleChatMessagePacket(c *Client, p pk.Packet) (err error) { } if c.Events.ChatMsg != nil { - err = c.Events.ChatMsg(s, byte(pos), string(sender.Encode())) + err = c.Events.ChatMsg(s, byte(pos), uuid.UUID(sender)) } return err diff --git a/cmd/autofish/autofish.go b/cmd/autofish/autofish.go index 741f8ea..611090d 100644 --- a/cmd/autofish/autofish.go +++ b/cmd/autofish/autofish.go @@ -1,6 +1,7 @@ package main import ( + "github.com/google/uuid" "log" "time" @@ -72,7 +73,7 @@ func onSound(name string, category int, x, y, z float64, volume, pitch float32) return nil } -func onChatMsg(c chat.Message, pos byte, uuid string) error { +func onChatMsg(c chat.Message, pos byte, uuid uuid.UUID) error { log.Println("Chat:", c) return nil } diff --git a/cmd/daze/daze.go b/cmd/daze/daze.go index acdd252..7ede457 100644 --- a/cmd/daze/daze.go +++ b/cmd/daze/daze.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "github.com/google/uuid" "log" "github.com/Tnze/go-mc/bot" @@ -38,7 +39,7 @@ func onGameStart() error { return nil //if err isn't nil, HandleGame() will return it. } -func onChatMsg(c chat.Message, pos byte, uuid string) error { +func onChatMsg(c chat.Message, pos byte, uuid uuid.UUID) error { log.Println("Chat:", c.ClearString()) // output chat message without any format code (like color or bold) return nil }