Class EventFilters

java.lang.Object
dev.demeng.pluginbase.event.filter.EventFilters

public final class EventFilters extends Object
Defines standard event predicates for use in functional event handlers.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends org.bukkit.event.Cancellable>
    @NotNull Predicate<T>
    Returns a predicate which only returns true if the event isn't cancelled
    static <T extends org.bukkit.event.player.PlayerLoginEvent>
    @NotNull Predicate<T>
    Returns a predicate which only returns true if the login is allowed
    static <T extends org.bukkit.event.player.AsyncPlayerPreLoginEvent>
    @NotNull Predicate<T>
    Returns a predicate which only returns true if the login is allowed
    static <T extends org.bukkit.event.Cancellable>
    @NotNull Predicate<T>
    Returns a predicate which only returns true if the event is cancelled
    static <T extends org.bukkit.event.player.PlayerMoveEvent>
    @NotNull Predicate<T>
    Returns a predicate which only returns true if the player has moved over a block
    static <T extends org.bukkit.event.player.PlayerMoveEvent>
    @NotNull Predicate<T>
    Returns a predicate which only returns true if the player has moved over a block, not including movement directly up and down.
    static <T extends org.bukkit.event.player.PlayerMoveEvent>
    @NotNull Predicate<T>
    Returns a predicate which only returns true if the player has moved over a chunk border
    static <T extends org.bukkit.event.player.PlayerEvent>
    @NotNull Predicate<T>
    Returns a predicate which only returns true if the player has the given permission

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • EventFilters

      public EventFilters()
  • Method Details

    • ignoreCancelled

      @NotNull public static <T extends org.bukkit.event.Cancellable> @NotNull Predicate<T> ignoreCancelled()
      Returns a predicate which only returns true if the event isn't cancelled
      Type Parameters:
      T - the event type
      Returns:
      a predicate which only returns true if the event isn't cancelled
    • ignoreNotCancelled

      @NotNull public static <T extends org.bukkit.event.Cancellable> @NotNull Predicate<T> ignoreNotCancelled()
      Returns a predicate which only returns true if the event is cancelled
      Type Parameters:
      T - the event type
      Returns:
      a predicate which only returns true if the event is cancelled
    • ignoreDisallowedLogin

      @NotNull public static <T extends org.bukkit.event.player.PlayerLoginEvent> @NotNull Predicate<T> ignoreDisallowedLogin()
      Returns a predicate which only returns true if the login is allowed
      Type Parameters:
      T - the event type
      Returns:
      a predicate which only returns true if the login is allowed
    • ignoreDisallowedPreLogin

      @NotNull public static <T extends org.bukkit.event.player.AsyncPlayerPreLoginEvent> @NotNull Predicate<T> ignoreDisallowedPreLogin()
      Returns a predicate which only returns true if the login is allowed
      Type Parameters:
      T - the event type
      Returns:
      a predicate which only returns true if the login is allowed
    • ignoreSameBlock

      @NotNull public static <T extends org.bukkit.event.player.PlayerMoveEvent> @NotNull Predicate<T> ignoreSameBlock()
      Returns a predicate which only returns true if the player has moved over a block
      Type Parameters:
      T - the event type
      Returns:
      a predicate which only returns true if the player has moved over a block
    • ignoreSameBlockAndY

      @NotNull public static <T extends org.bukkit.event.player.PlayerMoveEvent> @NotNull Predicate<T> ignoreSameBlockAndY()
      Returns a predicate which only returns true if the player has moved over a block, not including movement directly up and down. (so jumping wouldn't return true)
      Type Parameters:
      T - the event type
      Returns:
      a predicate which only returns true if the player has moved across a block border
    • ignoreSameChunk

      @NotNull public static <T extends org.bukkit.event.player.PlayerMoveEvent> @NotNull Predicate<T> ignoreSameChunk()
      Returns a predicate which only returns true if the player has moved over a chunk border
      Type Parameters:
      T - the event type
      Returns:
      a predicate which only returns true if the player has moved over a chunk border
    • playerHasPermission

      @NotNull public static <T extends org.bukkit.event.player.PlayerEvent> @NotNull Predicate<T> playerHasPermission(String permission)
      Returns a predicate which only returns true if the player has the given permission
      Type Parameters:
      T - the event type
      Parameters:
      permission - the permission
      Returns:
      a predicate which only returns true if the player has the given permission