Class EntityFinder

java.lang.Object
net.minestom.server.utils.entity.EntityFinder

public class EntityFinder extends Object
Represents a query which can be call to find one or multiple entities. It is based on the target selectors used in commands.
  • Constructor Details

    • EntityFinder

      public EntityFinder()
  • Method Details

    • setTargetSelector

      public EntityFinder setTargetSelector(@NotNull @NotNull EntityFinder.TargetSelector targetSelector)
    • setEntitySort

      public EntityFinder setEntitySort(@NotNull @NotNull EntityFinder.EntitySort entitySort)
    • setStartPosition

      public EntityFinder setStartPosition(@NotNull @NotNull net.minestom.server.coordinate.Point startPosition)
    • setDistance

      public EntityFinder setDistance(@NotNull net.minestom.server.utils.Range.Integer distance)
    • setLimit

      public EntityFinder setLimit(int limit)
    • setLevel

      public EntityFinder setLevel(@NotNull net.minestom.server.utils.Range.Integer level)
    • setEntity

      public EntityFinder setEntity(@NotNull @NotNull EntityType entityType, @NotNull @NotNull EntityFinder.ToggleableType toggleableType)
    • setConstantName

      public EntityFinder setConstantName(@NotNull @NotNull String constantName)
    • setConstantUuid

      public EntityFinder setConstantUuid(@NotNull @NotNull UUID constantUuid)
    • setName

      public EntityFinder setName(@NotNull @NotNull String name, @NotNull @NotNull EntityFinder.ToggleableType toggleableType)
    • setUuid

      public EntityFinder setUuid(@NotNull @NotNull UUID uuid, @NotNull @NotNull EntityFinder.ToggleableType toggleableType)
    • setGameMode

      public EntityFinder setGameMode(@NotNull @NotNull net.minestom.server.entity.GameMode gameMode, @NotNull @NotNull EntityFinder.ToggleableType toggleableType)
    • setDifference

      public EntityFinder setDifference(float dx, float dy, float dz)
    • find

      @NotNull public @NotNull List<@NotNull Entity> find(@Nullable @Nullable Instance instance, @Nullable @Nullable Entity self)
      Find a list of entities (could be empty) based on the conditions
      Parameters:
      instance - the instance to search from, null if the query can be executed using global data (all online players)
      self - the source of the query, null if not any
      Returns:
      all entities validating the conditions, can be empty
    • find

      @NotNull public @NotNull List<@NotNull Entity> find(@NotNull @NotNull CommandSender sender)
    • findFirstPlayer

      @Nullable public @Nullable Player findFirstPlayer(@Nullable @Nullable Instance instance, @Nullable @Nullable Entity self)
      Shortcut of find(Instance, Entity) to retrieve the first player element in the list.
      Returns:
      the first player returned by find(Instance, Entity)
      See Also:
    • findFirstPlayer

      @Nullable public @Nullable Player findFirstPlayer(@NotNull @NotNull CommandSender sender)
    • findFirstEntity

      @Nullable public @Nullable Entity findFirstEntity(@Nullable @Nullable Instance instance, @Nullable @Nullable Entity self)
    • findFirstEntity

      @Nullable public @Nullable Entity findFirstEntity(@NotNull @NotNull CommandSender sender)