2024-06-23 04:19:27 +00:00
|
|
|
package messages7
|
|
|
|
|
|
|
|
import (
|
|
|
|
"slices"
|
|
|
|
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
|
|
|
|
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
|
|
|
|
)
|
|
|
|
|
|
|
|
type RconCmd struct {
|
|
|
|
ChunkHeader *chunk7.ChunkHeader
|
|
|
|
|
|
|
|
Command string
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *RconCmd) MsgId() int {
|
2024-06-23 04:19:27 +00:00
|
|
|
return network7.MsgSysRconCmd
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *RconCmd) MsgType() network7.MsgType {
|
2024-06-23 04:19:27 +00:00
|
|
|
return network7.TypeNet
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *RconCmd) System() bool {
|
2024-06-23 04:19:27 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *RconCmd) Vital() bool {
|
2024-06-23 04:19:27 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *RconCmd) Pack() []byte {
|
2024-06-23 04:19:27 +00:00
|
|
|
return slices.Concat(
|
|
|
|
packer.PackStr(msg.Command),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-06-23 19:18:54 +00:00
|
|
|
func (msg *RconCmd) Unpack(u *packer.Unpacker) error {
|
2024-06-25 04:19:51 +00:00
|
|
|
msg.Command, _ = u.GetString()
|
2024-06-23 19:18:54 +00:00
|
|
|
return nil
|
2024-06-23 04:19:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *RconCmd) Header() *chunk7.ChunkHeader {
|
|
|
|
return msg.ChunkHeader
|
|
|
|
}
|
|
|
|
|
|
|
|
func (msg *RconCmd) SetHeader(header *chunk7.ChunkHeader) {
|
|
|
|
msg.ChunkHeader = header
|
|
|
|
}
|