Skip to content

Instantly share code, notes, and snippets.

@blackwolf12333
Last active January 2, 2016 05:49
Show Gist options
  • Save blackwolf12333/8259452 to your computer and use it in GitHub Desktop.
Save blackwolf12333/8259452 to your computer and use it in GitHub Desktop.
A prototype for how to use annotations to map the commands in a cleaner way.
@Command(command="save", aliases="s,sv")
public void save() {
player.save();
}
public void setup() {
list<Method> commands = getAllAnnotatedMethods();
for(Method m : commands) {
commandmap.put(m.getAnnotation().command(), m);
}
}
public @interface Command {
String command();
String aliases();
}
@blackwolf12333
Copy link
Author

Added the actuall annotation interface :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment