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