Skip to content

Commit

Permalink
unknown command message
Browse files Browse the repository at this point in the history
  • Loading branch information
oq-x committed Sep 26, 2023
1 parent 0be9890 commit 9be800a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/network/handlers/ChatCommand.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 9be800a

Please sign in to comment.