File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ package packets
2
+
3
+ type ServerNotification struct {
4
+ Packet
5
+ Type ServerNotificationType `json:"t"`
6
+ Content string `json:"c"`
7
+ }
8
+
9
+ type ServerNotificationType int
10
+
11
+ const (
12
+ ServerNotificationTypeError = iota
13
+ ServerNotificationTypeSuccess
14
+ ServerNotificationTypeInfo
15
+ )
16
+
17
+ func NewServerNotification (notificationType ServerNotificationType , content string ) * ServerNotification {
18
+ return & ServerNotification {
19
+ Packet : Packet {Id : PacketIdServerNotification },
20
+ Type : notificationType ,
21
+ Content : content ,
22
+ }
23
+ }
24
+
25
+ func NewServerNotificationError (content string ) * ServerNotification {
26
+ return NewServerNotification (ServerNotificationTypeError , content )
27
+ }
28
+
29
+ func NewServerNotificationSuccess (content string ) * ServerNotification {
30
+ return NewServerNotification (ServerNotificationTypeSuccess , content )
31
+ }
32
+
33
+ func NewServerNotificationInfo (content string ) * ServerNotification {
34
+ return NewServerNotification (ServerNotificationTypeInfo , content )
35
+ }
You can’t perform that action at this time.
0 commit comments