Commit graph

84 commits

Author SHA1 Message Date
Citymonstret
fc27fa5b51 chore(annotations): fix formatting issues 2022-06-18 22:52:58 -07:00
Alexander Söderberg
d681ba5840 feat: annotation string processors (#353)
adds a system for processing strings found in annotations before they're used by AnnotationParser

implements #347

Also, because we're using "-Werror", the code won't actually build (and thus tests won't work) using JDK18. To remedy this, a bunch of @SuppressWarnings("serial")s has been added to the exceptions. We don't serialize exceptions, and they're in fact non-serializable because of their members, so this is the appropriate solution (well, the better solution would be to make them serializable, but that's outside the scope of this PR).
2022-06-18 22:52:58 -07:00
zml
ed7b7569a8 build: switch to spotless (#355)
* build: switch to spotless

add in some other basic formatting steps that allow for easy
auto-correction

* build: lint text files as well

* chore: remove license headers from package-info files

spotless can't verify these
2022-06-18 22:52:58 -07:00
Jason Penilla
eae247954f build and publishing updates 2022-06-18 22:52:58 -07:00
Jason Penilla
708d11854e Fix import order 2021-12-02 02:04:43 -08:00
Jason Penilla
9dc4e87fa8 Use typesafe dependency accessors 2021-12-02 02:04:43 -08:00
Pasqual Koschmieder
526ef2af61 Allow parser parameter annotations for flags as well (#315) 2021-12-02 02:04:43 -08:00
Jason Penilla
4eb3df1f57 Fix error message for unknown parameters in KotlinAnnotatedMethods 2021-12-02 02:04:43 -08:00
Alexander Söderberg
ad80933a20 Feature: Allow argument names to be inferred from parameter names 2021-12-02 02:04:43 -08:00
Jason
3df3560d91 annotations: Also apply builder modifiers from class (#303) 2021-12-02 02:04:43 -08:00
Frank van der Heijden
7a5efbd6da Use AnnotationAccessor 2021-12-02 02:04:43 -08:00
Frank van der Heijden
730e78e212 Make CommandMethod applicable to class 2021-12-02 02:04:43 -08:00
alexander.soderg
d0162c3317 Annotations: Add test for multi-alias commands 2021-12-02 02:04:43 -08:00
Frank van der Heijden
3e28cc3191 Add @since and CHANGELOG.md entry for flag permissions 2021-12-02 02:04:43 -08:00
Frank van der Heijden
1b7fb2f34c Implement flag permissions 2021-12-02 02:04:43 -08:00
Alexander Söderberg
6871341291 I hate the fact that we started using Checkstyle.
Whose decision was that anyway..?
2021-12-02 02:04:43 -08:00
Alexander Söderberg
5934c2fd3b Add changelog 2021-12-02 02:04:43 -08:00
Alexander Söderberg
7bb5e63dc7 Add support for suspending functions
This also changes CommandExecutionHandler to return futures instead. The old method is still supported, and the new future-returning method will delegate to the old non-returning method.
2021-12-02 02:04:43 -08:00
zml
f7e756e901 annotations: Correct improper TypeToken toString use 2021-07-05 02:56:06 -07:00
Jason
c9ac39ed26 Update build scripts for Gradle 7 (#247)
* fabric: Update Loom to 0.7-SNAPSHOT

* Update to Gradle 7

Switch to CadixDev/licenser
The plugin we were using before does not support Gradle 7, and hasn't been updated in over a year.

* Remove `jcenter()` references

* Move to new JDA repo and bump version

* Use setup-java v2 and Adopt JDK 16 in gh actions

* build: Temporarily add Incendo repo for plugin resolution

Allows building until licenser has a new release

* Import indra plugin classes instead of string applies

* remove space

Co-authored-by: broccolai <me@broccol.ai>
2021-07-05 02:56:06 -07:00
Alexander Söderberg
1600ef16c3
:clock: 2021 let's go!!! 2021-01-16 09:58:46 +01:00
Alexander Söderberg
9550dce5e6 Add access to parameter annotations in the parameter injector 2021-01-16 08:54:07 +01:00
Alexander Söderberg
2cf743c805 Add injection services (#211)
*  Add injection services

* Change dependency scope for Guice
2021-01-16 08:54:07 +01:00
Zach Levis
b38c725dc5 core: Use the ArgumentDescription interface for descriptions
This allows minecraft-extras to provide an implementation that
uses Adventure chat components to represent the description.
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
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
Alexander Söderberg
94b960a992 🐛 Fix suppression in AnnotationParser 2020-12-18 19:49:57 +01:00
Alexander Söderberg
9ed40a698a Allow interception of command builders based on annotations in AnnotationParser
Fixes #179
2020-12-18 19:49:57 +01:00
Alexander Söderberg
52433a4c3a 🐛 Checkstyle is dumb. 2020-12-18 19:49:57 +01:00
Alexander Söderberg
6cc3a21619 Allow default suggestion providers in @Parser 2020-12-18 19:49:57 +01:00
Alexander Söderberg
e5a35afb8a Add @Parser annotated methods
Fixes #166. Also fixes #180.
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
Alexander Söderberg
ab366be24d :sparkes: Add @Suggestions annotated methods 2020-12-18 19:49:57 +01:00
Irmo van den Berge
e0216dec9f Add support for dashes and underscores in annotations parser syntax
Also added a test for the parser, as it was missing

Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
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
Josh Taylor
bd2034db77 Update cloud-annotations/src/main/java/cloud/commandframework/annotations/AnnotationParser.java
Co-authored-by: Alexander Söderberg <Sauilitired@users.noreply.github.com>
2020-12-07 20:05:45 +01:00
Josh Taylor
6c0f47c0bd Update cloud-annotations/src/main/java/cloud/commandframework/annotations/injection/RawArgs.java
Co-authored-by: Alexander Söderberg <Sauilitired@users.noreply.github.com>
2020-12-07 20:05:45 +01:00
Josh Taylor
014715c9e7 Update cloud-annotations/src/main/java/cloud/commandframework/annotations/MethodCommandExecutionHandler.java
Co-authored-by: Alexander Söderberg <Sauilitired@users.noreply.github.com>
2020-12-07 20:05:45 +01:00
broccolai
237eda75ef Reformat project 2020-12-07 20:05:45 +01:00
Irmo van den Berge
9e48a41eab 🐛 Annotations API fix
Annotations API fix failure when a literal name matches an argument name (#143)
2020-12-07 20:05:45 +01:00
Irmo van den Berge
1c7ebe0957 Fix junit test error when named suggestion provider runs before method construction
Parsing should occur in the @BeforeAll or this test fails sporadically

Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl>
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
e6af4e6caa Add a method to get the failure reason of SelectorParseExceptions 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
Alexander Söderberg
c2065aabd1 Add parameter injectors (#104) 2020-12-07 20:05:45 +01:00
Alexander Söderberg
a68bc0bea7 Allow for recursive annotations (#97)
Co-authored-by: Mariell <proximyst@proximyst.com>
2020-10-24 19:52:44 +02: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