Conversation
|
The code style is wrong in some files |
There was a problem hiding this comment.
Need better docs here for what the query result is.
There was a problem hiding this comment.
Right now there is a problem with this setter (tests fail).
Should I change it to setResult(Optional<CommandResult> result)?
There was a problem hiding this comment.
No Afaik the optional is only for return types.
There was a problem hiding this comment.
That's true, but the event system does not work if the setter does not use the same type.
There was a problem hiding this comment.
You haven't added the key 'result' to the SpongeEventFactory
|
I'm not sure about even having the processed flag in here. If we go with what I proposed in #551, the SimpleCommandService call method can handle all the logic of calling the event and printing not found messages if necessary. I definitely think adding a map for custom attributes is too much at this point in time. If somebody can give an actual (meaning something they're trying to do in a plugin), specific use case for it that is a lot more complicated without, then we can always add it in later. Also, you should expand on your javadocs to explain what each value does in terms of the game (like: entities affected is entities matched by arguments, success count is entities successfuly affected (why? who knows) I'll put in a few line comments on other little things. |
There was a problem hiding this comment.
This should be private or package-local (no spec) or this class should be marked final. We only want people instantiating it through the builder
b5eb229 to
01c87a3
Compare
|
This is now a part of zml's Commands Overhaul PR. Closing. |
Fixes #551. Closes #539. Closes #532. Closes #523. Add CommandResult object to hold results of command execution. Closes #552 Add LocatedSource class for command sources with a location Allow configurable conflict resoultion at command execution time Closes #562 Tweak formatting, work on dimension, world, and child command elements Add an abstract command element that supports matching by pattern and apply it to world, player, catalog type, and enum values argument types
Continuation of #409 and #524
This issue explains what command stats are used for: #326. I don't know why it was closed.
This PR replaces the
booleanthat is returned when a command is called with aCommandResultobject, which stores the command statsSuccessCount,AffectedBlocks,AffectedEntities,AffectedItemsandQueryResult. I also added aMapfor custom data.The
CommandResultis passed with theCommandEventafter the execution of the command.The implementation is based on @AlphaModder's pull request, but uses classes instead of interfaces to make it easier to use the system (similar to the Text API).
The only thing that changes is that plugin developers now have to use a builder to create a
CommandResult:I'm not sure if this is the best way of implementing it. I also thought about a system that uses separate classes for each result data type (similar to the Data API proposal):