Commit graph

248 commits

Author SHA1 Message Date
Irmo van den Berge
cabb7f426c Add predicate command filter option to the cloud help system
Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
2021-01-16 08:54:07 +01:00
Irmo van den Berge
4556f12b6d Fix command argument not accepting characters _ and -
Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
2021-01-16 08:54:07 +01:00
Alexander Söderberg
c48eb28434 🐛 Fix issues with the help system 2020-12-18 19:49:57 +01:00
Alexander Söderberg
c684c6607f Allow for literals to be combined with a variable arg(#181)
Co-authored-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
2020-12-18 19:49:57 +01:00
jmp
c86ccbe1af Fix build 2020-12-18 19:49:57 +01:00
Alexander Söderberg
e9178b0834 Add some QoL methods to FlagContext 2020-12-18 19:49:57 +01:00
Alexander Söderberg
744ebc929d 📚 Improve ArgumentParser documentation 2020-12-18 19:49:57 +01:00
Alexander Söderberg
885cc7e005 🎨 Fix formatting 2020-12-18 19:49:57 +01:00
Irmo van den Berge
5224050c99 Support repeating literals or argument names (#168)
Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
2020-12-18 19:49:57 +01:00
zml
1e91273e0e Work towards making CommandMeta typesafe (#173)
Co-authored-by: Alexander Söderberg <sauilitired@gmail.com>
2020-12-18 19:49:57 +01:00
jmp
3efd9bfffb Make CommandContext#asMap return an immutable copy 2020-12-18 19:49:57 +01:00
jmp
0a024d65d9 Add set, contains, and asMap methods to CommandContext 2020-12-18 19:49:57 +01:00
jmp
79aad9d79a Add getters for permission and sender type to Command.Builder 2020-12-18 19:49:57 +01:00
jmp
f2f187f58d 🐛 Fix build 2020-12-18 19:49:57 +01:00
Alexander Söderberg
2f077e03f3 Improve injection 2020-12-18 19:49:57 +01:00
jmp
e241420ee9 Throw an exception when trying to parse a static method with the @CommandMethod annotation 2020-12-18 19:49:57 +01:00
broccolai
237eda75ef Reformat project 2020-12-07 20:05:45 +01:00
jmp
ded94567c6 Add a ManagerSetting to override existing commands 2020-12-07 20:05:45 +01:00
jmp
1ff5a2c4ce 📚 Update changelog
Add back an entry which was accidentally removed, move an entry to the correct location, add missing entries
2020-12-07 20:05:45 +01:00
Jason
9bc2da18a9 🐛 Fix number suggestions when there are following arguments (#122) 2020-12-07 20:05:45 +01:00
jmp
544c344f18 📚 Update changelog
Also minor codestyle fixes
2020-12-07 20:05:45 +01:00
Irmo van den Berge
5b610df013 Fix partial command suggestions when using a suggestion provider
Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
2020-12-07 20:05:45 +01:00
Irmo van den Berge
8c46471952 Rename CommandContext getOrDefault to getorSupplyDefault
Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
2020-12-07 20:05:45 +01:00
zml
013d2d61f4 Give CommandManager a registration state (#148)
* Make CommandManager track its availability for registration

This prevents situations where changes to the manager
would result in undefined state in other places.

* Add unsafe registration capability

* Very minor formatting + `@since` tags

* Add changes to changelog

Co-authored-by: Alexander Söderberg <sauilitired@gmail.com>
2020-12-07 20:05:45 +01:00
Alexander Söderberg
d8f0b1a47e Allow passing a supplier to command context
This fixes #116
2020-12-07 20:05:45 +01:00
jmp
e9134efad6 Add more tests for ambiguous command registration
Also clean up after leaving the Command Tree in an invalid state during tests
2020-12-07 20:05:45 +01:00
jmp
7df6917fe4 Added CommandExecutionException which wraps any exception thrown during the execution of command handlers. Should be handled using CommandManager#registerExceptionHandler, similar to NoSuchCommandException, ArgumentParseException, etc. 2020-12-07 20:05:45 +01:00
jmp
fc1a613463 Allow for use of named suggestion providers in @Flag annotated command method parameters, add methods to FlagContext to work with flag values as optionals 2020-12-07 20:05:45 +01:00
jmp
dbdafed273 🐛 Fix Bukkit alias command suggestions without Brigadier 2020-12-07 20:05:45 +01:00
jmp
e6af4e6caa Add a method to get the failure reason of SelectorParseExceptions 2020-12-07 20:05:45 +01:00
jmp
f1cc2689a0 Add a test for ambiguous command registration 2020-12-07 20:05:45 +01:00
jmp
5e27148d82 Throw AmbiguousNodeException for more ambiguous cases 2020-12-07 20:05:45 +01:00
jmp
9c9e13e8b8 Allow for use of @Completions annotation with argument types other than String 2020-12-07 20:05:45 +01:00
jmp
9a5c674f0d 🐛 Use the correct default values for Double and Float ranges in the StandardParserRegistry 2020-12-07 20:05:45 +01:00
Alexander Söderberg
d484b99fc4 Store the currently parsing argument in the command context
This fixes #101
2020-12-07 20:05:45 +01:00
Alexander Söderberg
c2065aabd1 Add parameter injectors (#104) 2020-12-07 20:05:45 +01:00
Alexander Söderberg
cfac2639ad Add errorprone and fix warnings/errors
The compiler will also treat all warnings as errors from now on.
2020-10-24 19:52:44 +02:00
jmp
6ffee9d04f Make changes from PR comments 2020-10-24 19:52:44 +02:00
Alexander Söderberg
3c7bd63f07 Add named suggestion providers
This allows for pre-registration of command suggestion providers, that can then be used in annotated command methods.
2020-10-24 19:52:44 +02:00
Alexander Söderberg
37e0b4e91b 📚 Change false to true in method javadoc 2020-10-24 19:52:44 +02:00
Alexander Söderberg
65b7cb6c69 🔥 Fix super important issues 2020-10-24 19:52:44 +02:00
Alexander Söderberg
bd19e1be56 Make the flag parser smarter
It will now allow multiple presence flag aliases to be joined into a single flag, such that `-a -b -c <=> -abc`.

This fixes #75
2020-10-24 19:52:44 +02:00
Alexander Söderberg
da0d586e52 📚 Add missing @Since annotations 2020-10-24 19:52:44 +02:00
Alexander Söderberg
d6ccc1d59b 🧹 Clean up the gradle build scripts a little
Changes:
- Move all dependency versions to a shared file
- Order the projects in settings.gradle
2020-10-24 19:52:44 +02:00
Alexander Söderberg
ad3ca86f42 Add a lockable command manager
This will be used for Sponge & Fabric, that both require command registration to happen (at latest) in specific events. This way we lock writing after that event has occurred.

As a side effect, we're able to collect & merge all commands before registering them to the platform, which means we don't have to hackily force-inject duplicate commands.
2020-10-24 19:52:44 +02:00
jmp
15c6c8a2a1 🐛 Suggest the right amount of arguments with >1 requestedArgumentCount 2020-10-24 19:52:44 +02:00
Alexander Söderberg
79aefb05b5 Add LocationArgument to cloud-bukkit (#63)
*  Add LocationArgument to cloud-bukkit

* 🎨 Use the Bukkit CommandSender from the command context in LocationArgument

* 🐛 Fixed quoted parsing in StringArgument

* 📚 Fix code style

Co-authored-by: jmp <jasonpenilla2@me.com>
2020-10-24 19:52:44 +02:00
Alexander Söderberg
1249b74e83 📚 Add since annotations to new classes 2020-10-24 19:52:44 +02:00
jmp
fba29041e6 🎨 Add caption for string "No input was provided" 2020-10-24 19:52:44 +02:00
Alexander Söderberg
366c4f2ce5 Add an adventure text colour parser 2020-10-24 19:52:44 +02:00