I mean custom attributes in general - because reflection is disallowed, one can't really use them.
One example I'm using attributes for currently:
[Command("example")]
[CommandInfo("does some example stuff")]
void CommandExample(...){
...
}
void CommandHelp(...){
//Generate a list of commands based on the CommandInfo Attributes
...
}
This way, I don't have to keep a seperate list of commands.
Another example:
private Dictionary<MethodInfo, EventRoutineAttribute> EventRoutines { get; set; }
void Init() {
...
EventRoutines = GetMethodsWithAttribute<EventRoutineAttribute>();
}
[EventRoutine("example")]
private bool Example(...) {...}
private void ExampleHook(...){
foreach (var registeredRoutine in EventRoutines) {
//do some stuff
registeredRoutine.Key.Invoke(this, new[] { ... })
}
}
I'm using attributes to register behaviours for later use so I don't have to bloat my Init() method.
I could show you the complete plugin if needed, but I think you understand what I mean.
Maybe change the rules to "reflection over the own plugin (using e.g. GetType() as entry point) is okay" - I get that this is a valid security concern, but breaking your own plugin.. well is the problem of the author then, I guess? :D