Interface RangeFilter


public interface RangeFilter
Turns a Range into a test for whether one player should receive a message, by distance, by world, by server or across the whole proxy.
  • Method Details

    • createFilter

      @NonNull Predicate<FPlayer> createFilter(@NonNull EventMetadata eventMetadata, @NonNull MessageContext messageContext)
      Builds the receiver test for a message from its metadata.
      Parameters:
      eventMetadata - supplies the range and the extra filter
      messageContext - supplies the sender the range is measured from
      Returns:
      the test a player must pass to receive the message
    • createFilter

      @NonNull Predicate<FPlayer> createFilter(@NonNull FEntity filterPlayer, @NonNull Range range)
      Builds the receiver test for an explicit sender and range.
      Parameters:
      filterPlayer - the entity the range is measured from
      range - the range
      Returns:
      the test a player must pass to receive the message
    • checkDistance

      boolean checkDistance(@NonNull FPlayer fPlayer, @NonNull FPlayer fReceiver, int range)
      Whether two players are in the same world and within the given radius.
      Parameters:
      fPlayer - the sender
      fReceiver - the candidate receiver
      range - the radius in blocks
      Returns:
      true if the receiver is close enough
    • checkWorldNamePermission

      boolean checkWorldNamePermission(@NonNull FPlayer fPlayer, @NonNull FPlayer fReceiver)
      Whether the receiver may read messages from the sender's world, by world name.
      Parameters:
      fPlayer - the sender
      fReceiver - the candidate receiver
      Returns:
      true if the receiver is allowed
    • checkWorldTypePermission

      boolean checkWorldTypePermission(@NonNull FPlayer fPlayer, @NonNull FPlayer fReceiver)
      Whether the receiver may read messages from the sender's world, by world type.
      Parameters:
      fPlayer - the sender
      fReceiver - the candidate receiver
      Returns:
      true if the receiver is allowed