Beispiel #1
0
        private object IOnServerCommand(BoltConnection connection, string command, string data)
        {
            if (command.Length != 0)
            {
                // Create array of arguments
                string[] args = data.Split(' ');

                // Call hooks for plugins
                if (Interface.Call("OnServerCommand", command, args) != null)
                {
                    return(true);
                }

                // Is it a valid command?
                IPlayer player = new TheForestConsolePlayer();
                if (!Covalence.CommandSystem.HandleConsoleMessage(player, $"{command} {data}") && !nativeCommands.ContainsKey(command))
                {
                    player.Reply(string.Format(lang.GetMessage("UnknownCommand", this, player.Id), command));
                    return(true);
                }
            }

            return(null);
        }
 /// <summary>
 /// Initializes the command system
 /// </summary>
 public TheForestCommandSystem()
 {
     registeredCommands = new Dictionary <string, RegisteredCommand>();
     commandHandler     = new CommandHandler(CommandCallback, registeredCommands.ContainsKey);
     consolePlayer      = new TheForestConsolePlayer();
 }