protected EssCommand() { _commandInfo = Preconditions.NotNull( ReflectionUtil.GetAttributeFrom<CommandInfo>( this ), "EssCommand must have 'CommandInfo' attribute" ); UsageMessage = "Use /" + Name + " " + Usage; Logger = EssProvider.Logger; Permission = GetType().Assembly.Equals( typeof( EssCore ).Assembly ) ? $"essentials.command.{Name}" : _commandInfo.Permission; if ( Permission.IsNullOrEmpty() ) Permission = Name; }
private void Init( bool hasCmdParam, MethodInfo method ) { _info = Preconditions.NotNull( ReflectionUtil.GetAttributeFrom<CommandInfo>( method ), "methodAction must have 'CommandInfo' attribute." ); Owner = hasCmdParam ? _methodActionWithCommand.Method.DeclaringType : _methodAction.Method.DeclaringType; _hasCommandParameter = hasCmdParam; Permission = GetType().Assembly.Equals( typeof (EssCore).Assembly ) ? $"essentials.command.{Name}" : _info.Permission; }