Use packet queue for bot
framework.
Providing concurrently-safing for sending packets.
This commit is contained in:
@ -51,7 +51,7 @@ func (p *Player) Respawn() error {
|
||||
const PerformRespawn = 0
|
||||
|
||||
err := p.c.Conn.WritePacket(pk.Marshal(
|
||||
int32(packetid.ServerboundClientCommand),
|
||||
packetid.ServerboundClientCommand,
|
||||
pk.VarInt(PerformRespawn),
|
||||
))
|
||||
if err != nil {
|
||||
|
@ -54,7 +54,7 @@ func (p *Player) handleLoginPacket(packet pk.Packet) error {
|
||||
return Error{err}
|
||||
}
|
||||
err = p.c.Conn.WritePacket(pk.Marshal( // PluginMessage packet
|
||||
int32(packetid.ServerboundCustomPayload),
|
||||
packetid.ServerboundCustomPayload,
|
||||
pk.Identifier("minecraft:brand"),
|
||||
pk.String(p.Settings.Brand),
|
||||
))
|
||||
@ -63,7 +63,7 @@ func (p *Player) handleLoginPacket(packet pk.Packet) error {
|
||||
}
|
||||
|
||||
err = p.c.Conn.WritePacket(pk.Marshal(
|
||||
int32(packetid.ServerboundClientInformation), // Client settings
|
||||
packetid.ServerboundClientInformation, // Client settings
|
||||
pk.String(p.Settings.Locale),
|
||||
pk.Byte(p.Settings.ViewDistance),
|
||||
pk.VarInt(p.Settings.ChatMode),
|
||||
|
Reference in New Issue
Block a user