support kicker status

This commit is contained in:
adman
2026-04-17 21:51:47 +02:00
parent acc583f694
commit 7a2081f0a0
2 changed files with 13 additions and 15 deletions
+10 -1
View File
@@ -8,6 +8,8 @@ import (
"github.com/admin-else/strom/proto_base"
"github.com/admin-else/strom/proto_generated/v1_21_8"
"github.com/admin-else/strom/text"
"fmt"
)
var (
@@ -21,8 +23,15 @@ func Kick(c *proto.Conn, reason *text.Component) (err error) {
return
}
switch c.State() {
case proto_base.Handshaking, proto_base.Status:
case proto_base.Handshaking:
err = CantKickInStateErr
case proto_base.Status:
var b []byte
b, err = reason.MarshalJSON()
if err != nil {
return
}
err = c.Send(&v1_21_8.StatusToClientPacketServerInfo{Response: fmt.Sprintf("{\"description\":%s}", string(b))})
case proto_base.Login:
var b []byte
b, err = reason.MarshalJSON()