/
play_status.go
39 lines (33 loc) · 927 Bytes
/
play_status.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
33
34
35
36
37
38
39
package packet
import (
"bytes"
"encoding/binary"
)
const (
PlayStatusLoginSuccess int32 = iota
PlayStatusLoginFailedClient
PlayStatusLoginFailedServer
PlayStatusPlayerSpawn
PlayStatusLoginFailedInvalidTenant
PlayStatusLoginFailedVanillaEdu
PlayStatusLoginFailedEduVanilla
PlayStatusLoginFailedServerFull
)
// PlayStatus is sent by the server to update a player on the play status. This includes failed statuses due
// to a mismatched version, but also success statuses.
type PlayStatus struct {
// Status is the status of the packet. It is one of the constants found above.
Status int32
}
// ID ...
func (*PlayStatus) ID() uint32 {
return IDPlayStatus
}
// Marshal ...
func (pk *PlayStatus) Marshal(buf *bytes.Buffer) {
_ = binary.Write(buf, binary.BigEndian, pk.Status)
}
// Unmarshal ...
func (pk *PlayStatus) Unmarshal(buf *bytes.Buffer) error {
return binary.Read(buf, binary.BigEndian, &pk.Status)
}