From bd9d01382d38f65367ecd09f3d9d700ea6a761f8 Mon Sep 17 00:00:00 2001 From: Riley Date: Wed, 11 May 2022 20:49:36 +0200 Subject: [PATCH] requested changes --- chat.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/chat.go b/chat.go index db4dc8b..1ff20dc 100644 --- a/chat.go +++ b/chat.go @@ -13,20 +13,13 @@ import ( // about a chat command that's taking long to execute. var ChatCmdTimeout = 10 * time.Second -// Exec handles a string as if it where send by a client. -// string is imediate returnvalue of chatcommand (if applicable) -// bool is if msg is getting forwarded to the minetest server -func (cc *ClientConn) Exec(msg string) (string, bool) { - pkt := &mt.ToSrvChatMsg{ - Msg: msg, - } - - str, fwd := onChatMsg(cc, pkt) +// DoChatMsg does a chatcommand +func (cc *ClientConn) DoChatMsg(msg string) (string, bool) { + cmd := &mt.ToSrvChatMsg{Msg: msg} + str, fwd := onChatMsg(cc, cmd) if fwd { - cc.server().Send(*&mt.Pkt{ - Cmd: pkt, - }) + cc.server().SendCmd(cmd) } return str, fwd