rename bot/chat to bot/msg
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
package chat
|
||||
package msg
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -13,14 +13,14 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type Chat struct {
|
||||
type Manager struct {
|
||||
c *bot.Client
|
||||
p *basic.Player
|
||||
}
|
||||
|
||||
func NewChat(c *bot.Client, p *basic.Player, events EventsHandler) *Chat {
|
||||
func New(c *bot.Client, p *basic.Player, events EventsHandler) *Manager {
|
||||
attachPlayerMsg(c, p, events.PlayerChatMessage)
|
||||
return &Chat{c, p}
|
||||
return &Manager{c, p}
|
||||
}
|
||||
|
||||
func attachPlayerMsg(c *bot.Client, p *basic.Player, handler func(msg chat.Message) error) {
|
@ -1,4 +1,4 @@
|
||||
package chat
|
||||
package msg
|
||||
|
||||
import "github.com/Tnze/go-mc/chat"
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
|
||||
"github.com/Tnze/go-mc/bot"
|
||||
"github.com/Tnze/go-mc/bot/basic"
|
||||
botchat "github.com/Tnze/go-mc/bot/chat"
|
||||
"github.com/Tnze/go-mc/bot/msg"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
_ "github.com/Tnze/go-mc/data/lang/en-us"
|
||||
"github.com/Tnze/go-mc/data/packetid"
|
||||
@ -20,7 +20,7 @@ const timeout = 45
|
||||
var (
|
||||
c *bot.Client
|
||||
p *basic.Player
|
||||
bc *botchat.Chat
|
||||
bc *msg.Manager
|
||||
|
||||
watch chan time.Time
|
||||
)
|
||||
@ -34,7 +34,7 @@ func main() {
|
||||
Disconnect: onDisconnect,
|
||||
Death: onDeath,
|
||||
})
|
||||
bc = botchat.NewChat(c, p, botchat.EventsHandler{PlayerChatMessage: onChatMsg})
|
||||
bc = msg.New(c, p, msg.EventsHandler{PlayerChatMessage: onChatMsg})
|
||||
|
||||
// Register event handlers
|
||||
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
"github.com/Tnze/go-mc/bot"
|
||||
"github.com/Tnze/go-mc/bot/basic"
|
||||
botchat "github.com/Tnze/go-mc/bot/chat"
|
||||
"github.com/Tnze/go-mc/bot/msg"
|
||||
"github.com/Tnze/go-mc/bot/screen"
|
||||
"github.com/Tnze/go-mc/bot/world"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
@ -31,7 +31,7 @@ var (
|
||||
var (
|
||||
client *bot.Client
|
||||
player *basic.Player
|
||||
chatHandler *botchat.Chat
|
||||
chatHandler *msg.Manager
|
||||
worldManager *world.World
|
||||
screenManager *screen.Manager
|
||||
)
|
||||
@ -52,7 +52,7 @@ func main() {
|
||||
HealthChange: onHealthChange,
|
||||
Death: onDeath,
|
||||
})
|
||||
chatHandler = botchat.NewChat(client, player, botchat.EventsHandler{
|
||||
chatHandler = msg.New(client, player, msg.EventsHandler{
|
||||
PlayerChatMessage: onPlayerMsg,
|
||||
})
|
||||
worldManager = world.NewWorld(client, player, world.EventsListener{
|
||||
|
Reference in New Issue
Block a user