Interface ILocatable<T>
- Type Parameters:
T
- The type of entity we are implementing this interface into. Must be specified so the correct locations are returned when checking nearby.
- All Known Implementing Classes:
Nations
,Players
,SquaremapOnlinePlayer
,SquaremapOnlineResident
,Towns
public interface ILocatable<T>
This class specifies that an entity is locatable and provides methods to get other nearby locatable entities.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns a new map of entities that are within the specified x and z radii given the coordinates.
-
Field Details
-
INT_ARRAY_X
static final int[] INT_ARRAY_X -
INT_ARRAY_Z
static final int[] INT_ARRAY_Z
-
-
Method Details
-
getNearbyEntities
-
getNearbyEntities
default Map<String,T> getNearbyEntities(Map<String, T> entities, Integer xPos, Integer zPos, Integer xRad, Integer zRad) Returns a new map of entities that are within the specified x and z radii given the coordinates.Important notes:
Filtering is performed in parallel and is not guaranteed to be thread-safe. In addition, the resulting map will be collected with any nulls removed.
- Parameters:
entities
- The map of entities to be checked against. Usually online players, but accepts a mix of Player, Resident, Town or Nation.xPos
- The x coordinate.zPos
- The z coordinate.xRad
- The radius to check within on the x-axis. (Left/Right)zRad
- The radius to check within on the z-axis. (Up/Down)- Returns:
- A new map of entities where each entry key is its name, and the value is itself.
-