forked from Sandertv/gophertunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disconnect.go
32 lines (28 loc) · 1.06 KB
/
disconnect.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package packet
import (
"github.com/Adrian8115/gophertunnel-Amethyst-Protocol/minecraft/protocol"
)
// Disconnect may be sent by the server to disconnect the client using an optional message to send as the
// disconnect screen.
type Disconnect struct {
// Reason is the reason for the disconnection. It seems as if this field has no use other than for
// telemetry reasons as it does not affect the message that gets displayed on the disconnect screen.
Reason int32
// HideDisconnectionScreen specifies if the disconnection screen should be hidden when the client is
// disconnected, meaning it will be sent directly to the main menu.
HideDisconnectionScreen bool
// Message is an optional message to show when disconnected. This message is only written if the
// HideDisconnectionScreen field is set to true.
Message string
}
// ID ...
func (*Disconnect) ID() uint32 {
return IDDisconnect
}
func (pk *Disconnect) Marshal(io protocol.IO) {
io.Varint32(&pk.Reason)
io.Bool(&pk.HideDisconnectionScreen)
if !pk.HideDisconnectionScreen {
io.String(&pk.Message)
}
}