Ejemplo n.º 1
0
        //+ INTERACTIONS
        public override bool Execute(string[] args)
        {
            if (args == null || args.Length != 3)
            {
                GuuCore.LOGGER?.LogError($"The '<color=white>{Command}</color>' command takes 3 arguments");
                return(false);
            }

            string id   = args[0].Replace(" ", "_").ToLowerInvariant();
            string text = args[1];
            string cmd  = args[2];

            if (args[0].Contains(" "))
            {
                GuuCore.LOGGER?.LogWarning($"The '<color=white><id></color>' argument cannot contain any spaces. Using '<color=white>_</color>' instead! (New ID: {id})");
            }

            bool result = GuuConsole.RegisterButton(new ConsoleButton(id, text, cmd, true));

            if (result)
            {
                GuuCore.LOGGER?.Log($"Added new user defined button '<color=white>{id}</color>' with command '<color=white>{cmd}</color>'", GuuConsole.SUCCESS_COLOR);
            }

            return(result);
        }
Ejemplo n.º 2
0
        //+ INTERACTIONS
        public override bool Execute(string[] args)
        {
            if (args == null || args.Length != 3)
            {
                GuuCore.LOGGER?.LogError($"The '{Command}' command takes 3 arguments");
                return(false);
            }

            string id   = args[0].Replace(" ", "_").ToLowerInvariant();
            string text = args[1].Equals("*") ? GuuConsole.customButtons[id].Text : args[1];
            string cmd  = args[2].Equals("*") ? GuuConsole.customButtons[id].Command : args[2];

            if (args[0].Contains(" "))
            {
                GuuCore.LOGGER?.LogWarning($"The '<id>' argument cannot contain any spaces. Using '_' instead! (New ID: {id})");
            }

            bool result = GuuConsole.customButtons.ContainsKey(id) && GuuConsole.RegisterButton(new ConsoleButton(id, text, cmd, true), true);

            if (result)
            {
                GuuCore.LOGGER?.Log($"Edited user defined button '{id}'", GuuConsole.SUCCESS_COLOR);
            }

            return(result);
        }