public TextCommand(TextCommands.TextCommandData data) { _texts = new List <TextEntry>(); _commands = new List <CommandEntry>(); Name = data.Name; Usage = string.Empty; Aliases = new string[0]; Description = string.Empty; AllowedSource = AllowedSource.BOTH; Permission = $"essentials.textcommand.{Name}"; data.Text.ForEach(txt => { if (txt.StartsWith("console_execute:")) { _commands.Add(new CommandEntry { IsConsoleExecutor = true, Command = txt.Substring(16) }); return; } if (txt.StartsWith("execute:")) { _commands.Add(new CommandEntry { IsConsoleExecutor = false, Command = txt.Substring(8) }); return; } var color = ColorUtil.GetColorFromString(ref txt); _texts.Add(new TextEntry { Text = txt, Color = color }); }); }
public TextCommand(TextCommands.TextCommandData data) { Data = data; Name = data.Name; Usage = string.Empty; Aliases = new string[0]; Description = string.Empty; AllowedSource = AllowedSource.BOTH; Permission = $"essentials.textcommand.{Name}"; }
private void Init(bool hasCmdParam, MethodInfo method) { _info = Preconditions.NotNull( ReflectionUtil.GetAttributeFrom <CommandInfo>(method), "methodAction must have 'CommandInfo' attribute." ); Owner = hasCmdParam ? _methodFuncWithCommand.Method.DeclaringType : _methodFunc.Method.DeclaringType; _hasCommandParameter = hasCmdParam; Name = _info.Name; Usage = _info.Usage; Description = _info.Description; AllowedSource = _info.AllowedSource; Aliases = _info.Aliases; Permission = GetType().Assembly.Equals(typeof(EssCore).Assembly) ? $"essentials.command.{Name}" : _info.Permission; }