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

Add information about using selectors in command elements. #744

Merged
merged 3 commits into from Aug 20, 2018

Conversation

dualspiral
Copy link
Contributor

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

@Spongy
Copy link

Spongy commented Aug 18, 2018

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.


.. 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>`_
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -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
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

@Inscrutable Inscrutable left a 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.

(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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quieried? "queried"


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.
Copy link
Member

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"

@dualspiral
Copy link
Contributor Author

@Inscrutable All sorted.

@Inscrutable Inscrutable merged commit a186d5e into stable Aug 20, 2018
@dualspiral dualspiral deleted the feature/selector branch August 20, 2018 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants