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 information about using selectors in command elements. #744
Conversation
d68cd9c
to
cf41cb6
Compare
A preview for this pull request is available at https://cdn.rawgit.com/Spongy/SpongeDocs-PRs/67e0a4a/. Here are some links to the pages that were modified: Since the preview frequently changes, please link to this comment, not to the direct url to the preview. |
source/plugin/commands/arguments.rst
Outdated
|
||
.. tip:: | ||
|
||
Look at the `SelectorCommandElement source code <https://github.com/SpongePowered/SpongeAPI/blob/stable-7/src/main/java/org/spongepowered/api/command/args/SelectorCommandElement.java>`_ |
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.
Maybe link to https://github.com/SpongePowered/SpongeAPI/blob/stable-7/src/main/java/org/spongepowered/api/command/args/SelectorCommandElement.java#L40
to omit the license header stuff.
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.
Done
source/plugin/commands/arguments.rst
Outdated
@@ -10,7 +10,11 @@ Argument Parsing | |||
org.spongepowered.api.command.args.CommandContext | |||
org.spongepowered.api.command.args.CommandElement | |||
org.spongepowered.api.command.args.GenericArguments | |||
org.spongepowered.api.command.args.SelectorCommandElement |
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.
To you use this import somewhere?
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.
My original version did, just left this in.
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.
Querying your querying. Just some typos.
source/plugin/commands/arguments.rst
Outdated
(getting a set of :javadoc:`Entity` objects selected by the selector). | ||
|
||
To **parse** a selector string, use the :javadoc:`Selector#parse(String)` method, passing the entire selector, | ||
including the ``@`` symbol. This will turn the string into a ``Selector`` object that can be quieried or 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.
quieried? "queried"
source/plugin/commands/arguments.rst
Outdated
|
||
The following ``parseValue`` method from the ``CommandElement`` class attempts to parse a selector and return a set of | ||
entities based on the location of the ``CommandSource``. If the passed string does not start with ``@``, an exception | ||
is thrown indicating the passed argument is not a selector. |
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.
is thrown -> "will be thrown"
@Inscrutable All sorted. |
Just added information about how to use it with command elements. Also changed an example to avoid the use of a class-based variable.
See #238