Exemplo n.º 1
0
 public override List <string> GetAutoComplete(int argIndex, string argText)
 {
     if (argIndex == 0)
     {
         return(ConsoleBinder.GetAllBinds());
     }
     else
     {
         return(base.GetAutoComplete(argIndex, argText));
     }
 }
Exemplo n.º 2
0
        public override bool Execute(string[] args)
        {
            if (args == null)
            {
                Console.LogError($"The '<color=white>{ID}</color>' command takes 1 argument");
                return(false);
            }

            if (ArgsOutOfBounds(args.Length, 1, 1))
            {
                return(false);
            }

            if (args[0].Contains(" "))
            {
                Console.LogError($"The '<color=white><id></color>' argument cannot contain any spaces");
                return(false);
            }

            if (!args[0].Equals("all"))
            {
                if (ConsoleBinder.RemoveBind(args[0]))
                {
                    Console.LogSuccess($"Removed user defined button '<color=white>{args[0]}</color>'");
                    return(true);
                }
            }
            else
            {
                ConsoleBinder.RemoveAll();
                Console.LogSuccess($"Removed all user defined buttons");
                return(true);
            }

            Console.LogError($"The user defined button '<color=white>{args[0]}</color>' was not found");
            return(false);
        }
Exemplo n.º 3
0
        public override bool Execute(string[] args)
        {
            if (args == null)
            {
                Console.LogError($"The '<color=white>{ID}</color>' command takes 3 arguments");
                return(false);
            }

            if (ArgsOutOfBounds(args.Length, 3, 3))
            {
                return(false);
            }

            if (args[0].Contains(" "))
            {
                Console.LogError($"The '<color=white><id></color>' argument cannot contain any spaces");
                return(false);
            }

            if (args[0].Equals("all"))
            {
                Console.LogWarning($"Trying to register user defined button with id '<color=white>all</color>' but '<color=white>all</color>' is not a valid id!");
                return(false);
            }

            if (Console.cmdButtons.ContainsKey("user." + args[0]))
            {
                Console.LogWarning($"Trying to register user defined button with id '<color=white>{args[0]}</color>' but the ID is already registered!");
                return(false);
            }

            ConsoleBinder.RegisterBind(args[0], args[1], args[2]);
            Console.LogSuccess($"Added new user defined button '<color=white>{args[0]}</color>' with command '<color=white>{args[2]}</color>'");

            return(true);
        }