Correct behavior of method Client.Disconnect()

This commit is contained in:
Sunbread
2020-01-14 17:19:12 +08:00
parent 3041792dac
commit a8798ce9fb

View File

@ -2,7 +2,6 @@ package bot
import ( import (
"errors" "errors"
"github.com/Tnze/go-mc/chat"
"strconv" "strconv"
"github.com/Tnze/go-mc/data" "github.com/Tnze/go-mc/data"
@ -180,13 +179,10 @@ func (c *Client) SwapItem() error {
return c.playerAction(6, 0, 0, 0, 0) return c.playerAction(6, 0, 0, 0, 0)
} }
// Disconnect send disconnect packet to server. // Disconnect disconnect the server.
// Server will close the connection after receive this packet. // Server will close the connection.
func (c *Client) Disconnect(reason chat.Message) error { func (c *Client) Disconnect() error {
return c.conn.WritePacket(pk.Marshal( return c.conn.Close()
data.DisconnectPlay,
reason,
))
} }
// SendPacket send the packet to server. // SendPacket send the packet to server.