-
-
Notifications
You must be signed in to change notification settings - Fork 75
Rename Adventure arguments #474
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
Conversation
DerEchtePilz
left a comment
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.
Yes, I did review my own PR :D
Basically, I just want to remind myself to actually make these changes when the time has come
| @@ -1,5 +1,35 @@ | |||
| # Upgrading guide | |||
|
|
|||
| ## From 9.?.? to 10.0.0 | |||
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.
Make this 9.?.? say the correct version when this is ready to be merged
|
The one mildly annoying thing with this PR is the developer experience. Developers now need to ensure that they import the "right one". There are no compile-time checks that will catch the case if a developer accidentally uses the wrong argument. (I'm only saying "mildly annoying", because the CommandAPI does have cases where it has classes which have the same name as other cases, such as NamespacedKey) Not something worth rejecting the PR, just something to be aware of (of course, the fix for this is trivial on the developers point of view, and runtime errors will occur which should be detected during developer testing, so it's "easily identifiable"). We'll have to ensure that the documentation fully covers this to ensure that users don't mix them up (we should now have an intermediary "chat arguments" page, we can probably put a note about this there so developers know which package to import) |
Yeah, it is a little confusing. Similar things happened to me when I accidentally import Maybe this could be similar to those Going that way would pretty much be no change at all though. If it's not a big change, it's probably not going to solve the problem you are trying to solve.
As Skepter said, documentation is probably enough to solve any confusion from your current solution. |
|
Alright, I guess, this should be done. Once again, the only thing I am really not sure about is documentation. In this case, the So yeah, a code review would be appreciated for the whole PR :D |
willkroboth
left a comment
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 a few typos and small details I noticed. Otherwise, everything makes sense.
I'm still not sure what problem this is trying to solve. I've never used the chat arguments though, so I'm not sure how developers want to use them. One challenge I see with the setup here is providing support for Spigot and Adventure. Right now, if you want to use both ChatArguments in the same file, you need to use the fully qualified name (eg. dev.jorel.commandapi.arguments.spigot.ChatArgument) for at least one of them, which doesn't seem convenient. I don't know if anyone would want to do that, but this is currently happening in the ChatArgumentTests files.
I think placing the arguments as static classes like ChatArgument.Spigot and ChatArgument.Adventure fits better with existing Arguments (Eg. SoundArgument and SoundArgument.NamespacedKey both use the minecraft:resource_location Brigadier argument). I don't know though. The best solution probably depends on the problem that this is trying to solve.
If we think different packages is the best solution, this PR looks good to me 👍.
| * Tests for the {@link AdventureChatColorArgument} | ||
| * Tests for the {@link ChatColorArgument} | ||
| */ | ||
| class ArgumentAdventureChatColorTests extends TestBase { |
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.
I noticed that the ArgumentAdventureChatColorTests are separate from the ArgumentChatColorTests. On the other hand, the ArgumentChatComponentTests and ArgumentChatTests combine the Spigot and Paper tests. I'm not sure which way is best, but I think it would make sense to be consistent.
Combining the tests might make sense given that the Arguments have the same names now. On the other hand, having the tests separate is good because you don't need to use a fully qualified name to differentiate one of the arguments.
|
|
||
| /* ANCHOR: argumentChatSpigot3 */ | ||
| CommandAPICommand("pbroadcast") | ||
| .withArguments(dev.jorel.commandapi.arguments.adventure.ChatArgument("message")) |
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.
Looks like this is using wrong class. This is supposed to be a Spigot example.
| .withArguments(dev.jorel.commandapi.arguments.adventure.ChatArgument("message")) | |
| .withArguments(ChatArgument("message")) |
...dapi-documentation-code/src/main/java/dev/jorel/commandapi/examples/java/SpigotExamples.java
Outdated
Show resolved
Hide resolved
First, thanks for the review! |
|
Superseded by #517 |
This essentially makes these changes to make arguments that deal with the same Minecraft argument type have identical names:
TODO: