fix: handle empty kick status message properly in Status protocol state
This commit is contained in:
+3
-2
@@ -26,14 +26,15 @@ func Kick(c *proto.Conn, reason *text.Component, status string) (err error) {
|
|||||||
case proto_base.Handshaking:
|
case proto_base.Handshaking:
|
||||||
err = CantKickInStateErr
|
err = CantKickInStateErr
|
||||||
case proto_base.Status:
|
case proto_base.Status:
|
||||||
var b = []byte(status)
|
|
||||||
if status == "" {
|
if status == "" {
|
||||||
|
var b []byte
|
||||||
b, err = reason.MarshalJSON()
|
b, err = reason.MarshalJSON()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
status = fmt.Sprintf("{\"description\":%s}", string(b))
|
||||||
}
|
}
|
||||||
err = c.Send(&v1_21_8.StatusToClientPacketServerInfo{Response: fmt.Sprintf("{\"description\":%s}", string(b))})
|
err = c.Send(&v1_21_8.StatusToClientPacketServerInfo{Response: status})
|
||||||
case proto_base.Login:
|
case proto_base.Login:
|
||||||
var b []byte
|
var b []byte
|
||||||
b, err = reason.MarshalJSON()
|
b, err = reason.MarshalJSON()
|
||||||
|
|||||||
Reference in New Issue
Block a user