Esempio n. 1
0
        public bool Handle(Character character, string text)
        {
            var words = text.Split(' ');

            _commands.TryGetValue(words[0].ToLower(), out var command);
            if (command == null)
            {
                return(false);
            }

            if (AccessLevel.getLevel(words[0].ToLower()) > character.AccessLevel)
            {
                character.SendMessage("Insufficient privileges.");
                return(false);
            }

            var args = new string[words.Length - 1];

            if (words.Length > 1)
            {
                Array.Copy(words, 1, args, 0, words.Length - 1);
            }
            command.Execute(character, args);
            return(true);
        }