-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[B+C] Add Location.getNearbyEntities. Adds BUKKIT-3868 #1068
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -429,6 +429,46 @@ public interface World extends PluginMessageRecipient, Metadatable { | |
*/ | ||
public Collection<Entity> getEntitiesByClasses(Class<?>... classes); | ||
|
||
/** | ||
* Returns a collection of entities within a bounding box centered around the | ||
* specified location | ||
* | ||
* @param center the center of the bounding box | ||
* @param x 1/2 the size of the box along x axis | ||
* @param y 1/2 the size of the box along y axis | ||
* @param z 1/2 the size of the box along z axis | ||
* @return List<Entity> List of entities nearby | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This
|
||
*/ | ||
public Collection<Entity> getEntities(Location center, double x, double y, double z); | ||
|
||
/** | ||
* Get a collection of all entities in this World matching the given | ||
* class/interface within a specific area | ||
* | ||
* @param center the center of the bounding box | ||
* @param x 1/2 the size of the box along x axis | ||
* @param y 1/2 the size of the box along y axis | ||
* @param z 1/2 the size of the box along z axis | ||
* @param cls The class representing the type of entity to match | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually took this as a suggestion, straight from the existing code: public Collection getEntitiesByClass(Class cls); I'll make it clazz, though. I agree that "cls" is bad, but there was a precedent, so I went with it. |
||
* @return A List of all Entities currently residing in this world that | ||
* match the given class/interface within the given area | ||
*/ | ||
public <T extends Entity> Collection<T> getEntitiesByClass(Location center, double x, double y, double z, Class<T> cls); | ||
|
||
/** | ||
* Get a collection of all entities in this World matching any of the | ||
* given classes/interfaces within a specific area | ||
* | ||
* @param center the center of the bounding box | ||
* @param x 1/2 the size of the box along x axis | ||
* @param y 1/2 the size of the box along y axis | ||
* @param z 1/2 the size of the box along z axis | ||
* @param classes The classes representing the types of entity to match | ||
* @return A List of all Entities currently residing in this world that | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha- again, this is all copy+paste .. I mean that's a poor excuse, but I tried to make these look like the existing getEntities methods. That said, I'm changing all of mine to something like "A Collection of entities nearby", and leaving the old ones alone, e.g.:
|
||
* match one or more of the given classes/interfaces in the area | ||
*/ | ||
public Collection<Entity> getEntitiesByClasses(Location center, double x, double y, double z, Class<?>... classes); | ||
|
||
/** | ||
* Get a list of all players in this World | ||
* | ||
|
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.
This import is in the wrong spot