Last active
January 2, 2016 05:49
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added the actuall annotation interface :)