Commit graph

209 commits

Author SHA1 Message Date
Zach Levis
ef85fa9ee9 core: Add CommandFlag-accepting getters to FlagContext
This allows for type-safe access to the collection of available flags.
2021-01-16 08:54:07 +01:00
Jason
7347ced0db Expose Command/Context from exceptions where possible (#204)
* Expose Command/Context from exceptions where possible

* Update changelog
2021-01-16 08:54:07 +01:00
Alexander Söderberg
bb9bc4e579 Add keyed values to CommandContext and do some cleanup 2021-01-16 08:54:07 +01:00
Alexander Söderberg
9276a919d3 Add keyed values to CommandContext and do some cleanup 2021-01-16 08:54:07 +01:00
Jason
c8fdf22f4b Allow for more easily using translatable components with MinecraftHelp (#197)
*  Allow for more easily using translatable components with MinecraftHelp

* Add missing Javadoc
2021-01-16 08:54:07 +01:00
jmp
8913b2495e 🐛 Transition to AFTER_REGISTRATION even when no commands have been registered 2021-01-16 08:54:07 +01:00
jmp
7eddcd237a typo 2021-01-16 08:54:07 +01:00
jmp
b848070d57 Use an Object with fields instead of a Map for dependency versions 2021-01-16 08:54:07 +01:00
jmp
f1e467038c Rename vers to versions 2021-01-16 08:54:07 +01:00
jmp
2c188eb130 Convert build scripts to Kotlin
Also added some new tasks to only build/install to maven local certain platforms
`buildMinecraft`, `installMinecraft`, `buildDiscord`, `installDiscord`, `buildIRC`, `installIRC`
2021-01-16 08:54:07 +01:00
Irmo van den Berge
a978adc79f Add support for compound arguments for flags
Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
2021-01-16 08:54:07 +01:00
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