diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2021-09-09 21:45:15 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2021-09-09 21:45:15 +0200 |
commit | 8576d696e884a713bde6be3407f629f1f4b5537d (patch) | |
tree | 4d6706c1b8a4339010f00f6850842cbff24b69df /chatcommands.go | |
parent | 0a577710eea20862c0983ad5a7fb703bf6e20cef (diff) |
Fix send command
Diffstat (limited to 'chatcommands.go')
-rw-r--r-- | chatcommands.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/chatcommands.go b/chatcommands.go index 903f7b7..c8d7485 100644 --- a/chatcommands.go +++ b/chatcommands.go @@ -74,7 +74,7 @@ func init() { Name: "send", Perm: "cmd_send", Handler: func(cc *proxy.ClientConn, args ...string) string { - if len(args) != 2 { + if len(args) < 2 { return "Usage: send <player <server> <name> | current <server> | all <server>>" } @@ -109,6 +109,10 @@ func init() { clt.SendChatMsg("Could not switch servers. Reconnect if you encounter any problems. Error:", err.Error()) } case "current": + if len(args) != 2 { + return "Usage: send <player <server> <name> | current <server> | all <server>>" + } + if args[1] == cc.ServerName() { return "Start and destination are identical." } @@ -121,6 +125,10 @@ func init() { } } case "all": + if len(args) != 2 { + return "Usage: send <player <server> <name> | current <server> | all <server>>" + } + for clt := range proxy.Clts() { if clt.ServerName() != args[1] { if err := clt.Hop(args[1]); err != nil { @@ -184,7 +192,7 @@ func init() { srvs[i] = srv.Name } - return fmt.Sprintf("Connected to: %s | Servers: %s", cc.ServerName(), strings.Join(srvs, " ")) + return fmt.Sprintf("Connected to: %s | Servers: %s", cc.ServerName(), strings.Join(srvs, ", ")) } srv := strings.Join(args, " ") |