-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add the option to retrieve raw arguments #459
Conversation
commandapi-core/src/main/java/dev/jorel/commandapi/CommandAPIHandler.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use toArray(String[]::new)
, use toArray(new String[0])
instead when converting from a List<String>
(especially an ArrayList<String>
) to a String[]
I'm not entirely sold on the naming convention of "raw", but I don't have any better ideas. |
Well, I thought that if something wasn't dealt with already, it exists in its raw form... |
If you're happy with it, I'm happy with it. I got nothing. Just have to make sure it's clear in the documentation what we mean by a "raw" argument as not to cause any misunderstandings. |
Other than writing documentation for this, is this feature-complete? |
Yeah, I think so. |
I'm only willing to merge this when documentation has been written. Good shout for adding tests, I forgot about that! |
About the documentation, currently I am not very motivated to do this (partly because I want to add a complete new page for the |
Fair enough, I've still not even started working on the overhauled annotation system yet. These things just happen!
Yes, this is not an urgent feature, feel free to take all the time you need. |
99b17f9
to
c24d084
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some quick looks at the code. Only little tweaks that don't really have a big impact either way, so you could totally just resolve the comments and not use them if you think the current way is fine.
Sorry, I couldn't get to the documentation because I have to go now. I can just suggest looking through the GitHub Actions failures, which is complaining about the spacing between some of the lines (all lines should have 1 empty line between them).
commandapi-core/src/main/java/dev/jorel/commandapi/arguments/AbstractArgument.java
Outdated
Show resolved
Hide resolved
commandapi-core/src/main/java/dev/jorel/commandapi/arguments/AbstractArgument.java
Outdated
Show resolved
Hide resolved
commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java
Show resolved
Hide resolved
commandapi-core/src/main/java/dev/jorel/commandapi/arguments/SuggestionsBranch.java
Outdated
Show resolved
Hide resolved
commandapi-core/src/main/java/dev/jorel/commandapi/arguments/SuggestionsBranch.java
Outdated
Show resolved
Hide resolved
...kit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/CommandArgument.java
Outdated
Show resolved
Hide resolved
...kit/commandapi-bukkit-core/src/main/java/dev/jorel/commandapi/arguments/CommandArgument.java
Outdated
Show resolved
Hide resolved
…ethods for raw arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation reviewed as requested. I've requested a couple changes, notably:
- A bit of re-organizing of the
CommandArguments
page by removing the table-of-contents and the "What terms are used?" sections - Changing the format of "Access the inner structure directly" to match the way other pages in the documentation explain similar concepts
There's a lot of repetition with the node name and accessing by index under each section! After a long think about it, I'm going to approve that - I don't think it needs changing, but ensure that when it comes to writing examples you keep them concise - an example isn't necessary for every single method and once you've given an example of one concept you don't have to repeat it for every one (for example, you can write an example for get(String)
and get(int)
, an example for getOrDefault(String, Object/Supplier)
and getOptional(String)
in the "Access arguments" section. In the "access raw arguments" section, an example of just accessing getRaw(String)
would be sufficient and likewise with the "access unsafe arguments" section - an example of getUnchecked(String)
would be sufficient).
An explanation at the top of "access raw arguments" is necessary to let users know what we're talking about (refactoring the explanation in "What terms are used" to this section would make a lot of sense here). Likewise with unsafe arguments.
Hopefully this review isn't too long!
commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java
Outdated
Show resolved
Hide resolved
commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java
Show resolved
Hide resolved
commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java
Show resolved
Hide resolved
commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java
Outdated
Show resolved
Hide resolved
…ng with raw arguments
…with CommandArguments#fullInput
commandapi-core/src/main/java/dev/jorel/commandapi/executors/CommandArguments.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the issue with JavaDocs for the CommandArguments
record, we're ready to merge.
I think this needs a little bit more work but I am still opening the PR now
ToDo's:
CommandArguments
to that new pageupgrading.md
intro.md
optional_arguments.md
@Deprecated
annotation from theCommandArguments#getOrDefaultUnchecked
methods because theCommandArguments#getOptionalUnchecked
methods require you to provide a type or cast it which is not great