Class SimpleTempListener<E extends org.bukkit.event.Event>

java.lang.Object
com.ultikits.ultitools.interfaces.impl.SimpleTempListener<E>
Type Parameters:
E - Event type
All Implemented Interfaces:
TempListener, org.bukkit.event.Listener

public class SimpleTempListener<E extends org.bukkit.event.Event> extends Object implements TempListener
Simple temp listener.
See Also:
  • Field Details

    • eventClass

      private Class<E extends org.bukkit.event.Event> eventClass
    • priority

      private org.bukkit.event.EventPriority priority
    • eventHandler

      private TempEventHandler<E extends org.bukkit.event.Event> eventHandler
    • filter

      private Function<E extends org.bukkit.event.Event,Boolean> filter
    • REGISTERED

      private static final Set<SimpleTempListener<?>> REGISTERED
      Tracks which listener instances are currently registered, so a second register() call on the same instance is a no-op instead of a silent duplicate Bukkit registration. Static (not an instance field) so it does not change @AllArgsConstructor's generated signature. Weak keys so a listener that is simply dropped (never unregistered) does not leak.
  • Constructor Details

    • SimpleTempListener

      @Deprecated(since="6.3.0", forRemoval=true) public SimpleTempListener()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the four-argument (Class, EventPriority, TempEventHandler, Function) constructor (Lombok-generated via @AllArgsConstructor, so it has no source declaration to link to) or TempListener.common(Class). Scheduled for removal in 6.4.0.
      Hand-written rather than Lombok-generated so it can carry its own javadoc. Lombok's @NoArgsConstructor(onConstructor_ = @Deprecated(...)) form was confirmed (via javap on the compiled class) to correctly carry since/forRemoval into the class file under this project's -source 1.8 / JDK 21 toolchain, but a Lombok-generated member has no source declaration to attach a @deprecated tag to.
      Scheduled removal version:
      6.4.0
    • SimpleTempListener

      @Deprecated(since="6.3.0", forRemoval=true) public SimpleTempListener(Class<E> eventClass, TempEventHandler<E> eventHandler)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the four-argument (Class, EventPriority, TempEventHandler, Function) constructor (Lombok-generated via @AllArgsConstructor, so it has no source declaration to link to) or TempListener.common(Class). Scheduled for removal in 6.4.0.
      No filter, default priority. Indistinguishable at the call site from the other three-and-fewer-argument constructors below - this confusability is exactly why these constructors are being removed (T-05-37).
      Scheduled removal version:
      6.4.0
    • SimpleTempListener

      @Deprecated(since="6.3.0", forRemoval=true) public SimpleTempListener(Class<E> eventClass, TempEventHandler<E> eventHandler, Function<E,Boolean> filter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the four-argument (Class, EventPriority, TempEventHandler, Function) constructor (Lombok-generated via @AllArgsConstructor, so it has no source declaration to link to) or TempListener.common(Class). Scheduled for removal in 6.4.0.
      Filter, default priority.
      Scheduled removal version:
      6.4.0
    • SimpleTempListener

      @Deprecated(since="6.3.0", forRemoval=true) public SimpleTempListener(Class<E> eventClass, TempEventHandler<E> eventHandler, org.bukkit.event.EventPriority priority)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use the four-argument (Class, EventPriority, TempEventHandler, Function) constructor (Lombok-generated via @AllArgsConstructor, so it has no source declaration to link to) or TempListener.common(Class). Scheduled for removal in 6.4.0.
      No filter, explicit priority. This is the overload build() used to resolve to before SILENT-12 was fixed - the last-parameter arity clash with the constructor above (a Function vs. an EventPriority in the same position) is the defect mechanism this deprecation window exists to remove.
      Scheduled removal version:
      6.4.0
  • Method Details

    • register

      public void register()
      Description copied from interface: TempListener
      Register the listener.
      Specified by:
      register in interface TempListener
    • unregister

      public void unregister()
      Unregister the listener and clear its registration tracking so a later register() call on the same instance actually re-registers.
      Specified by:
      unregister in interface TempListener