From a8798ce9fbd3deb2311d51d151ea741b1a41fe81 Mon Sep 17 00:00:00 2001 From: Sunbread Date: Tue, 14 Jan 2020 17:19:12 +0800 Subject: [PATCH] Correct behavior of method Client.Disconnect() --- bot/motion.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/bot/motion.go b/bot/motion.go index 1e1d227..a147d21 100644 --- a/bot/motion.go +++ b/bot/motion.go @@ -2,7 +2,6 @@ package bot import ( "errors" - "github.com/Tnze/go-mc/chat" "strconv" "github.com/Tnze/go-mc/data" @@ -180,13 +179,10 @@ func (c *Client) SwapItem() error { return c.playerAction(6, 0, 0, 0, 0) } -// Disconnect send disconnect packet to server. -// Server will close the connection after receive this packet. -func (c *Client) Disconnect(reason chat.Message) error { - return c.conn.WritePacket(pk.Marshal( - data.DisconnectPlay, - reason, - )) +// Disconnect disconnect the server. +// Server will close the connection. +func (c *Client) Disconnect() error { + return c.conn.Close() } // SendPacket send the packet to server.