MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / Call

Method Call

server/command/manager.go:34–67  ·  view source on GitHub ↗
(command string, caller Caller)

Source from the content-addressed store, hash-verified

32}
33
34func (mgr *Manager) Call(command string, caller Caller) {
35 arguments := strings.Split(command, " ")
36 if len(arguments) == 0 {
37 caller.SystemMessage(
38 text.Unmarshal(
39 "&cInvalid command", '&',
40 ),
41 )
42 return
43 }
44 cmd := mgr.findCommand(arguments[0])
45 if cmd == nil {
46 caller.SystemMessage(
47 text.Unmarshalf(
48 '&',
49 "&cUnknown command %s",
50 command,
51 ),
52 )
53 return
54 }
55 ctx := CommandCallContext{
56 Command: *cmd,
57 Executor: caller,
58 Server: mgr.srv,
59 }
60 if len(arguments) > 1 {
61 ctx.Arguments = arguments[1:]
62 }
63 if cmd.Callback == nil {
64 return
65 }
66 cmd.Callback(ctx)
67}
68
69func (mgr *Manager) findCommand(name string) *Command {
70 mgr.mu.RLock()

Callers 3

StartConsoleFunction · 0.80
StartRawConsoleFunction · 0.80

Calls 4

findCommandMethod · 0.95
UnmarshalFunction · 0.92
UnmarshalfFunction · 0.92
SystemMessageMethod · 0.65

Tested by

no test coverage detected