summaryrefslogtreecommitdiff
path: root/messages.go
blob: 805334d1ec7055c191956f0ec87d070731f05254 (plain)
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
40
41
42
43
44
45
46
// messages.go
package main

type IncomingMessage struct {
	Type       string  `json:"type"` // "auth", "chat", "location", "nick"
	Token      string  `json:"token,omitempty"`
	Nick       string  `json:"nick,omitempty"`
	ServerID   string  `json:"serverId,omitempty"`
	PlayerUUID string  `json:"playerUuid,omitempty"`

	Message   string  `json:"message,omitempty"`
	X         float64 `json:"x,omitempty"`
	Y         float64 `json:"y,omitempty"`
	Z         float64 `json:"z,omitempty"`
	Dimension string  `json:"dimension,omitempty"`
}

type AuthOK struct {
	Type         string `json:"type"` // "auth_ok"
	InternalName string `json:"internalName"`
}

type AuthError struct {
	Type  string `json:"type"` // "auth_error"
	Error string `json:"error"`
}

type OutChat struct {
	Type         string `json:"type"` // "chat"
	FromNick     string `json:"fromNick"`
	FromInternal string `json:"fromInternal"`
	Message      string `json:"message"`
	Timestamp    int64  `json:"timestamp"`
}

type OutLocation struct {
	Type      string  `json:"type"` // "location"
	Nick      string  `json:"nick"`
	Internal  string  `json:"internal"`
	ServerID  string  `json:"serverId"`
	X         float64 `json:"x"`
	Y         float64 `json:"y"`
	Z         float64 `json:"z"`
	Dimension string  `json:"dimension"`
	Timestamp int64   `json:"timestamp"`
}