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, Player, Players, Resident, Towns

public interface ILocatable<T>
This class specifies that an entity is locatable and provides methods to get other nearby locatable entities.
  • Field Details

    • INT_ARRAY_X

      static final Integer[] INT_ARRAY_X
    • INT_ARRAY_Z

      static final Integer[] INT_ARRAY_Z
  • Method Details

    • getNearby

      default Map<String,T> getNearby(Map<String,T> map, Integer xCoord, Integer zCoord, Integer radius)
    • getNearby

      default Map<String,T> getNearby(Map<String,T> map, Integer xCoord, Integer zCoord, Integer xRadius, Integer zRadius)
      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:
      map - The map of entities to be checked against. Usually online players, but accepts a mix of Player, Resident, Town or Nation.
      xCoord - The x coordinate.
      zCoord - The z coordinate.
      xRadius - The radius to check within on the x-axis. (Left/Right)
      zRadius - 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.