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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.ultikits.ultitools.interfaces.TempListener
TempListener.DefaultTempListenerBuilder<E extends org.bukkit.event.Event> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate TempEventHandler<E> private org.bukkit.event.EventPriorityprivate static final Set<SimpleTempListener<?>> Tracks which listener instances are currently registered, so a secondregister()call on the same instance is a no-op instead of a silent duplicate Bukkit registration. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version.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) orTempListener.common(Class).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) orTempListener.common(Class).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) orTempListener.common(Class). -
Method Summary
Modifier and TypeMethodDescriptionvoidregister()Register the listener.voidUnregister the listener and clear its registration tracking so a laterregister()call on the same instance actually re-registers.
-
Field Details
-
eventClass
-
priority
private org.bukkit.event.EventPriority priority -
eventHandler
-
filter
-
REGISTERED
Tracks which listener instances are currently registered, so a secondregister()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, 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) orTempListener.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 carrysince/forRemovalinto 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@deprecatedtag 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) orTempListener.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) orTempListener.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) orTempListener.common(Class). Scheduled for removal in 6.4.0.No filter, explicit priority. This is the overloadbuild()used to resolve to before SILENT-12 was fixed - the last-parameter arity clash with the constructor above (aFunctionvs. anEventPriorityin 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:TempListenerRegister the listener.- Specified by:
registerin interfaceTempListener
-
unregister
public void unregister()Unregister the listener and clear its registration tracking so a laterregister()call on the same instance actually re-registers.- Specified by:
unregisterin interfaceTempListener
-
(Class, EventPriority, TempEventHandler, Function)constructor (Lombok-generated via@AllArgsConstructor, so it has no source declaration to link to) orTempListener.common(Class).