From 2bda0d63c2b03c775fd50edffa676da1e4734e95 Mon Sep 17 00:00:00 2001 From: JunDao Date: Tue, 14 May 2019 23:26:22 +0800 Subject: [PATCH] handle encryption error --- bot/mcbot.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bot/mcbot.go b/bot/mcbot.go index 896a510..5700a25 100644 --- a/bot/mcbot.go +++ b/bot/mcbot.go @@ -130,7 +130,9 @@ func (c *Client) JoinServer(addr string, port int) (err error) { } return case 0x01: //Encryption Request - handleEncryptionRequest(c, pack) + if err := handleEncryptionRequest(c, pack); err != nil { + return fmt.Errorf("bot: encryption fail: %v", err) + } case 0x02: //Login Success // uuid, l := pk.UnpackString(pack.Data) // name, _ := unpackString(pack.Data[l:]) @@ -142,7 +144,7 @@ func (c *Client) JoinServer(addr string, port int) (err error) { } c.conn.SetThreshold(int(threshold)) case 0x04: //Login Plugin Request - fmt.Println("Waring Login Plugin Request") + // fmt.Println("Waring Login Plugin Request")//TODO: handle plugin request } } }