Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VarArgs Support #308

Closed
creatorfromhell opened this issue Nov 26, 2023 · 2 comments · Fixed by #339
Closed

VarArgs Support #308

creatorfromhell opened this issue Nov 26, 2023 · 2 comments · Fixed by #339
Labels

Comments

@creatorfromhell
Copy link

creatorfromhell commented Nov 26, 2023

I think a feature to support VarArgs for commands would be nice. This could be specified by using an array in the argument type.

An example would be with a gamerule command: /world setrules worldname rule1:true rule2:true rule3:true

Code:

public void gamerule(Player sender, @Arg @Name("world") World world, @Arg @Name("gamerule") Gamerule[] rules)

Alternative code:

public void gamerule(Player sender, @Arg @Name("world") World world, @VarArg @Name("gamerule") Gamerule[] rules)
@CarmJos
Copy link
Contributor

CarmJos commented Nov 27, 2023

I think this feature can be implement by creating a new argument type like GameruleSetup with join resolve to process all values.

@CarmJos
Copy link
Contributor

CarmJos commented Nov 27, 2023

The single @VarArg may not support what you want, it only Gamerule[], not Map<Gamerule,Boolean>.

So, using the @Join GameruleSetup[] setups may be the best solution for you.

Rollczi added a commit that referenced this issue Dec 29, 2023
* Add array arguments, better performance for command analyze and execution.

* Fix quote resolver. Spilt array tests.

* Support java 8

* Add type domain, TypeToken, TypeIndex, TypeRange. Add Collector arguments for List, Set, Vector, Stack, TreeSet etc.

* Add IterableSuperClassResolver and ReflectIndex. Refactor ParserSet.

* Fix interface types resolving.

* Remove unused imports.

* Specific unittest for jdk 21

* Remove unused code.

* Add collection examples.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants