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

More command tweaks #2296

Merged
merged 1 commit into from
Apr 3, 2021
Merged

More command tweaks #2296

merged 1 commit into from
Apr 3, 2021

Conversation

dualspiral
Copy link
Contributor

@dualspiral dualspiral commented Feb 6, 2021

SpongeAPI | Sponge Impl

While I've got a minute...

  • Introduces ValueParameter.Simple which is primarily used to allow the use of Mojang provided parameters that we wrap - they don't need to know about the CommandContext.Builder so this allows third party frameworks to use the Mojang provided parameters.

    Note that aspirationally, at some point I might associate a ClientCompletionKey with each of these to make it clear what parameter links to what key - again, a QoL thing for third party consumers.

    This will fix the issue in Inherite from default parameters in a more restrictive way #2290 insofar as composition is concerned, though the next point will make that moot.

  • Adds a ValueParameterModifier that modifies the output/completions of a parameter. This is generally going to be easier than trying to recreate a parameter (such as entities) itself.

    I have not allowed for the transformation of parameter types. As well as it being difficult to do because of the more strongly typed system we have, it's not really encouraged that non-parsing logic should go in a parser - they should do the minimum to validate that a parameter is valid for the context - if a later parameter fails then the work in the parser is wasted and so it is best to do as much work as possible in the executor, when you have a guarantee that your transformations will be used.

    This should be a better way of solving the issue in Inherite from default parameters in a more restrictive way #2290 and basically sidestep the problem in Missing ClientCompletionTypes #2289.

@dualspiral dualspiral added system: command status: needs testing api: 8 (u) version: 1.16 (unsupported since Oct 17th 2023) labels Feb 6, 2021
@dualspiral dualspiral force-pushed the api8/command-simple-params branch 3 times, most recently from 19d0683 to 85761f9 Compare April 3, 2021 12:34
* Add ValueParameterModifier
* Fix command JD warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: 8 (u) version: 1.16 (unsupported since Oct 17th 2023) system: command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant