From 9be800a3a651cc619c147c59e7065730ea53738d Mon Sep 17 00:00:00 2001 From: oqammx86 <84847714+oq-x@users.noreply.github.com> Date: Wed, 27 Sep 2023 01:35:39 +0300 Subject: [PATCH] unknown command message --- server/network/handlers/ChatCommand.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/network/handlers/ChatCommand.go b/server/network/handlers/ChatCommand.go index 91e2ad7..e335e97 100644 --- a/server/network/handlers/ChatCommand.go +++ b/server/network/handlers/ChatCommand.go @@ -1,12 +1,17 @@ package handlers import ( + "fmt" "strings" "github.com/dynamitemc/dynamite/server/commands" ) -func ChatCommandPacket(controller interface{}, graph commands.Graph, content string) { +type controller interface { + SystemChatMessage(s string) error +} + +func ChatCommandPacket(controller controller, graph commands.Graph, content string) { args := strings.Split(content, " ") cmd := args[0] var command *commands.Command @@ -22,6 +27,7 @@ func ChatCommandPacket(controller interface{}, graph commands.Graph, content str } } if command == nil { + controller.SystemChatMessage(fmt.Sprintf("§cUnknown or incomplete command, see below for error\n%s§o<--[HERE]", content)) return } command.Execute(controller, args)