Last active
August 29, 2015 14:17
-
-
Save Romain-P/f1f2869affb107ba30ef to your computer and use it in GitHub Desktop.
My command DSL
This file contains hidden or 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
| binder.put("character", Commands.new("character", (c) -> c | |
| .withSub("customize", (sub) -> sub.to(CustomizeAction.class)) | |
| .withSub("remove", (sub) -> sub | |
| .to(RemoveAction.class) | |
| .withArg("definitly", "yes", "no")) //equals withRequiredArg("state" new String[] { "on", "off" }) | |
| .withSub("reload", (sub) -> sub.to(ReloadAction.class)) | |
| .iff(GmLevelCondition.class); | |
| .withAliases("!personnage", "!joueur")); | |
| //!character -customize | |
| //!character -remove (-definitly(yes/no)) | |
| //!character -reload | |
| binder.put("kolizeum", Commands.new("kolizeum", (c) -> c //possible without action, !kolizeum will return an error syntax | |
| .withRequiredArg("state", "on", "off") //required | |
| .withArg("group", "yes", "no")); | |
| //!kolizeum -state(on/off) -group(yes/no) | |
| binder.put("world", Commands.new("world", (c) -> c | |
| .to(SpeakToWorldAction.class) | |
| .withSpacedRequiredArg("message")); //note spaced allows an argument with spaces (need to be at the last arg) | |
| //!world #message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment