add support for EnableFeature and CustomReportDetails

This commit is contained in:
Tnze
2024-06-16 00:42:16 +08:00
parent ee23172e0a
commit 40b32dfdd7
3 changed files with 66 additions and 19 deletions

View File

@ -26,12 +26,17 @@ type Client struct {
Events Events
// Login plugins
LoginPlugin map[string]func(data []byte) ([]byte, error)
LoginPlugin map[string]CustomPayloadHandler
// Configuration handler
ConfigHandler
CustomReportDetails map[string]string
}
// CustomPayloadHandler is a function handling custom payload
type CustomPayloadHandler func(data []byte) ([]byte, error)
func (c *Client) Close() error {
return c.Conn.Close()
}
@ -45,9 +50,11 @@ func (c *Client) Close() error {
// and load your Name, UUID and AccessToken to client.
func NewClient() *Client {
return &Client{
Auth: Auth{Name: "Steve"},
Events: Events{handlers: make([][]PacketHandler, packetid.ClientboundPacketIDGuard)},
ConfigHandler: NewDefaultConfigHandler(),
Auth: Auth{Name: "Steve"},
Events: Events{handlers: make([][]PacketHandler, packetid.ClientboundPacketIDGuard)},
LoginPlugin: make(map[string]CustomPayloadHandler),
ConfigHandler: NewDefaultConfigHandler(),
CustomReportDetails: make(map[string]string),
}
}