Last updated for version 3.1.0 * - * @author 7orivorian + * @author 7orivorian + * @since 1.0.0 */ -class ExampleEvent extends CancelableEvent implements IStagedEvent { +class ExampleEvent extends StatusEvent implements IStagedEvent { private String message; private final EventStage stage; diff --git a/examples/java/me/tori/example/expanded/ExampleListener.java b/examples/java/me/tori/example/expanded/ExampleListener.java index c3de8fc..7d0ebaf 100644 --- a/examples/java/me/tori/example/expanded/ExampleListener.java +++ b/examples/java/me/tori/example/expanded/ExampleListener.java @@ -26,10 +26,9 @@ /** * Example listener. - *
Last updated for version 3.1.0
*
- * @author 7orivorian
- * @since 1.0.0
+ * @author 7orivorian
+ * @since 1.0.0
*/
class ExampleListener extends EventListener Last updated for version 3.1.0
+ * Example program.
*
- * @author 7orivorian
+ * @author 7orivorian
+ * @since 1.0.0
*/
class ExampleMain {
@@ -44,7 +44,7 @@ public static void main(String[] args) {
EVENT_BUS.dispatch(event1);
- if (!event1.isCanceled()) {
+ if (!event1.isSuppressed()) {
System.out.println(event1.getMessage());
}
@@ -52,7 +52,7 @@ public static void main(String[] args) {
EVENT_BUS.dispatch(event2);
- if (!event2.isCanceled()) {
+ if (!event2.isSuppressed()) {
System.out.println(event2.getMessage());
}
}
diff --git a/examples/java/me/tori/example/expanded/ExampleSubscriber.java b/examples/java/me/tori/example/expanded/ExampleSubscriber.java
index a8dae62..f3cf156 100644
--- a/examples/java/me/tori/example/expanded/ExampleSubscriber.java
+++ b/examples/java/me/tori/example/expanded/ExampleSubscriber.java
@@ -27,10 +27,9 @@
/**
* Example subscriber.
- * Last updated for version 3.1.0
*
- * @author 7orivorian
- * @since 1.0.0
+ * @author 7orivorian
+ * @since 1.0.0
*/
class ExampleSubscriber extends Subscriber {
diff --git a/examples/java/me/tori/example/simple/SimpleExample.java b/examples/java/me/tori/example/simple/SimpleExample.java
index b346f28..3d6fdfa 100644
--- a/examples/java/me/tori/example/simple/SimpleExample.java
+++ b/examples/java/me/tori/example/simple/SimpleExample.java
@@ -22,16 +22,14 @@
package me.tori.example.simple;
import me.tori.wraith.bus.EventBus;
-import me.tori.wraith.event.cancelable.CancelableEvent;
+import me.tori.wraith.event.status.StatusEvent;
import me.tori.wraith.listener.LambdaEventListener;
import me.tori.wraith.subscriber.Subscriber;
/**
- * One-class example
- *
- * Last updated for version 3.1.0
+ * One-class example.
*
- * @author 7orivorian
+ * @author 7orivorian
*/
class SimpleExample {
@@ -45,38 +43,23 @@ public static void main(String[] args) {
// Subscribe to the event bus
bus.subscribe(subscriber);
- SimpleEvent event;
-
// Create a simple event
- // This event will be canceled, see the lambda in SimpleSubscriber to know why ;P
- event = new SimpleEvent("Pie is gross!");
-
- if (!bus.dispatch(event)) {
- // Only log the message if our event isn't canceled
- System.out.println(event.getMessage());
- }
+ SimpleEvent event = new SimpleEvent("Pie is delicious <3");
- event = new SimpleEvent("Pie is delicious <3");
- if (!bus.dispatch(event)) {
- System.out.println(event.getMessage());
- }
+ // Dispatch our event
+ bus.dispatch(event);
}
private static final class SimpleSubscriber extends Subscriber {
public SimpleSubscriber() {
registerListener(
- new LambdaEventListener<>(SimpleEvent.class, event -> {
- if (event.getMessage().contains("gross")) {
- // Pie is not gross, so we cancel this event, preventing it from being written to the console
- event.cancel();
- }
- })
+ new LambdaEventListener<>(SimpleEvent.class, event -> System.out.println(event.getMessage()))
);
}
}
- private static final class SimpleEvent extends CancelableEvent {
+ private static final class SimpleEvent extends StatusEvent {
private final String message;
diff --git a/pom.xml b/pom.xml
index 3e33b59..c829fcb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,7 +10,7 @@
The {@code type} parameter serves as a filtering mechanism for listeners, enabling you to selectively invoke
+ * @see #dispatch(Object, Class, boolean)
+ * @since 3.3.0
+ */
+ @Override
+ public boolean dispatch(Object event, Class> type) {
+ return dispatch(event, type, false);
+ }
+
+ /**
+ * Convenience method to dispatch an event with no {@linkplain Listener#getType() listener type} restriction, and
+ * optional inverted processing priority.
+ *
+ * @see #dispatch(Object, Class, boolean)
+ * @since 3.3.0
+ */
+ @Override
+ public boolean dispatch(Object event, boolean invertPriority) {
+ return dispatch(event, null, invertPriority);
+ }
+
+ /**
+ * Dispatches the given event to all valid registered listeners.
+ *
+ * The {@code type} parameter serves as a filtering mechanism for listeners, enabling you to selectively invoke
* listeners based on their type, allowing for more targeted event handling.
*
* @param event the event to be dispatched
@@ -197,9 +220,10 @@ public boolean dispatch(Object event) {
* {@code false} otherwise
* @throws NullPointerException if the given event is {@code null}
* @throws UnsupportedOperationException if this event bus is {@link #shutdown}
+ * @since 3.3.0
*/
@Override
- public boolean dispatch(Object event, Class> type) {
+ public boolean dispatch(Object event, Class> type, boolean invertPriority) {
Objects.requireNonNull(event, "Cannot dispatch a null event to event bus " + id + "!");
if (isShutdown()) {
throw new UnsupportedOperationException("Dispatcher " + id + " is shutdown!");
@@ -209,8 +233,8 @@ public boolean dispatch(Object event, Class> type) {
dispatchToEachListener(
event,
this.listeners.get(event.getClass()),
- listener -> (type == null) || (listener.getType() == null) || (listener.getType() == type),
- false
+ listener -> listener.isAcceptableType(type) && IClassTargetingEvent.isListenerTargetedByEvent(listener, event),
+ invertPriority
);
if (event instanceof IStatusEvent e) {
@@ -228,7 +252,9 @@ public boolean dispatch(Object event, Class> type) {
* {@code false} otherwise
* @throws NullPointerException if the given event is {@code null}
* @throws UnsupportedOperationException if this event bus is {@link #shutdown}
+ * @deprecated This method's functionality is now built into {@link #dispatch(Object)}.
*/
+ @Deprecated(since = "3.3.0", forRemoval = true)
@Override
public boolean dispatchTargeted(IClassTargetingEvent event) {
return dispatchTargeted(event, null);
@@ -246,28 +272,12 @@ public boolean dispatchTargeted(IClassTargetingEvent event) {
* {@code false} otherwise
* @throws NullPointerException if the given event is {@code null}
* @throws UnsupportedOperationException if this event bus is {@link #shutdown}
+ * @deprecated This method's functionality is now built into {@link #dispatch(Object, Class)}.
*/
+ @Deprecated(since = "3.3.0", forRemoval = true)
@Override
public boolean dispatchTargeted(IClassTargetingEvent event, Class> type) {
- Objects.requireNonNull(event, "Cannot dispatch a null event to event bus " + id + "!");
- if (isShutdown()) {
- throw new UnsupportedOperationException("Dispatcher " + id + " is shutdown!");
- } else {
- taskExecutor.onEvent(event);
-
- dispatchToEachListener(
- event,
- this.listeners.get(event.getClass()),
- listener -> ((type == null) || (listener.getType() == null) || (listener.getType() == type))
- && listener.getClass().equals(event.getTargetClass()),
- false
- );
-
- if (event instanceof IStatusEvent e) {
- return e.isSuppressed() || e.isTerminated();
- }
- }
- return false;
+ return dispatch(event, type);
}
/**
@@ -279,7 +289,9 @@ public boolean dispatchTargeted(IClassTargetingEvent event, Class> type) {
* {@code false} otherwise
* @throws NullPointerException if the given event is {@code null}
* @throws UnsupportedOperationException if this event bus is {@link #shutdown}
+ * @deprecated This method's functionality is now built into {@link #dispatch(Object)}.
*/
+ @Deprecated(since = "3.3.0", forRemoval = true)
@Override
public boolean dispatchInverted(Object event) {
return dispatchInverted(event, null);
@@ -298,7 +310,9 @@ public boolean dispatchInverted(Object event) {
* {@code false} otherwise
* @throws NullPointerException if the given event is {@code null}
* @throws UnsupportedOperationException if this event bus is {@link #shutdown}
+ * @deprecated This method's functionality is now built into {@link #dispatch(Object)}.
*/
+ @Deprecated(since = "3.3.0", forRemoval = true)
@Override
public boolean dispatchInverted(Object event, Class> type) {
Objects.requireNonNull(event, "Cannot dispatch a null event to event bus " + id + "!");
@@ -310,7 +324,7 @@ public boolean dispatchInverted(Object event, Class> type) {
dispatchToEachListener(
event,
this.listeners.get(event.getClass()),
- listener -> (type == null) || (listener.getType() == null) || (listener.getType() == type),
+ listener -> listener.isAcceptableType(type) && IClassTargetingEvent.isListenerTargetedByEvent(listener, event),
true
);
@@ -365,7 +379,6 @@ public boolean isShutdown() {
/**
* @return the {@code id} of this event bus
- * @author 7orivorian
* @since 3.1.0
*/
public int getId() {
@@ -381,42 +394,32 @@ public int getId() {
* @param event the event to be handled by each listener that satisfies the predicate
* @param listeners the list of listeners to be processed
* @param predicate the condition that each listener must satisfy to have the action applied
- * @param invertPriority if {@code true}, listeners are processed in reverse order; otherwise,
+ * @param invertPriority if {@code true}, listeners are processed in order of inverse priority; otherwise,
* they are processed in normal order
* @since 3.2.0
*/
- @SuppressWarnings("DuplicatedCode")
private void dispatchToEachListener(Object event, List If the given object is an event bus, it is only considered equal if {@code this.id == that.id}.
+ *
+ * If the given object is an event bus, it is only considered equal if {@code this.id == that.id}.
*
* @param o the object to compare with
* @return {@code true} if the object is equal to this event bus, {@code false} otherwise
diff --git a/src/main/java/me/tori/wraith/bus/IEventBus.java b/src/main/java/me/tori/wraith/bus/IEventBus.java
index 6e905e4..a2167af 100644
--- a/src/main/java/me/tori/wraith/bus/IEventBus.java
+++ b/src/main/java/me/tori/wraith/bus/IEventBus.java
@@ -41,49 +41,86 @@ public interface IEventBus {
int DEFAULT_PRIORITY = 0;
/**
+ * Subscribes the specified subscriber to this event bus.
+ *
* @param subscriber the {@link ISubscriber} to be subscribed
* @see #register(Listener)
*/
void subscribe(ISubscriber subscriber);
/**
+ * Unsubscribes the specified subscriber from this event bus.
+ *
* @param subscriber the {@link ISubscriber} to be unsubscribed
* @see #unregister(Listener)
*/
void unsubscribe(ISubscriber subscriber);
/**
+ * Registers the specified listener to this event bus.
+ *
* @param listener the {@link Listener} to be registered
*/
void register(Listener> listener);
/**
+ * Unregisters the specified listener from this event bus.
+ *
* @param listener the {@link Listener} to be unregistered
*/
void unregister(Listener> listener);
/**
+ * Dispatches the specified event to all registered listeners.
+ *
* @param event the event to be dispatched
* @return {@code true} if the given event is {@linkplain IStatusEvent suppressed or terminated} by any listener,
- * {@code false} otherwise
+ * {@code false} otherwise.
*/
boolean dispatch(Object event);
/**
+ * Dispatches the specified event to all registered listeners of the specified type.
+ *
* @param event the event to be dispatched
* @param type the type of listener to invoke (can be {@code null})
* @return {@code true} if the given event is {@linkplain IStatusEvent suppressed or terminated} by any listener,
- * {@code false} otherwise
+ * {@code false} otherwise.
*/
boolean dispatch(Object event, Class> type);
/**
- * Shuts down this event bus, preventing future events from being dispatched
+ * Dispatches the specified event to all registered listeners, with the option to invert the processing priority.
+ *
+ * @param event the event to be dispatched
+ * @param invertPriority if {@code true}, listeners are processed in order of inverse priority; otherwise,
+ * they are processed in normal order
+ * @return {@code true} if the given event is {@linkplain IStatusEvent suppressed or terminated} by any listener,
+ * {@code false} otherwise.
+ */
+ boolean dispatch(Object event, boolean invertPriority);
+
+ /**
+ * Dispatches the specified event to all registered listeners of the specified type, with the option to invert the processing priority.
+ *
+ * @param event the event to be dispatched
+ * @param type the type of listener to invoke (can be {@code null})
+ * @param invertPriority if {@code true}, listeners are processed in order of inverse priority; otherwise,
+ * they are processed in normal order
+ * @return {@code true} if the given event is {@linkplain IStatusEvent suppressed or terminated} by any listener,
+ * {@code false} otherwise.
+ */
+ boolean dispatch(Object event, Class> type, boolean invertPriority);
+
+ /**
+ * Shuts down this event bus, preventing future events from being dispatched.
*/
void shutdown();
/**
- * @return {@code true} if this event bus is shut down, {@code false} otherwise
+ * Checks if this event bus is shut down.
+ *
+ * @return {@code true} if this event bus is shut down, {@code false} otherwise.
*/
boolean isShutdown();
}
\ No newline at end of file
diff --git a/src/main/java/me/tori/wraith/bus/InvertableEventBus.java b/src/main/java/me/tori/wraith/bus/InvertableEventBus.java
index b1e51a2..a49ecbc 100644
--- a/src/main/java/me/tori/wraith/bus/InvertableEventBus.java
+++ b/src/main/java/me/tori/wraith/bus/InvertableEventBus.java
@@ -24,9 +24,11 @@
import me.tori.wraith.event.status.IStatusEvent;
/**
- * @author 7orivorian
- * @since 3.0.0
+ * @author 7orivorian
+ * @since 3.0.0
+ * @deprecated This event bus' functionality is now built into the {@linkplain IEventBus standard event bus}.
*/
+@Deprecated(since = "3.3.0", forRemoval = true)
public interface InvertableEventBus extends IEventBus {
/**
@@ -34,7 +36,9 @@ public interface InvertableEventBus extends IEventBus {
* @return {@code true} if the given event is {@linkplain IStatusEvent suppressed or terminated} by any listener,
* {@code false} otherwise
* @see EventBus#dispatchInverted(Object)
+ * @deprecated This method's functionality is now handled by {@link #dispatch(Object, boolean)}.
*/
+ @Deprecated(since = "3.3.0", forRemoval = true)
boolean dispatchInverted(Object event);
/**
@@ -43,6 +47,8 @@ public interface InvertableEventBus extends IEventBus {
* @return {@code true} if the given event is {@linkplain IStatusEvent suppressed or terminated} by any listener,
* {@code false} otherwise
* @see EventBus#dispatchInverted(Object, Class)
+ * @deprecated This method's functionality is now handled by {@link #dispatch(Object, Class, boolean)}.
*/
+ @Deprecated(since = "3.3.0", forRemoval = true)
boolean dispatchInverted(Object event, Class> type);
}
\ No newline at end of file
diff --git a/src/main/java/me/tori/wraith/bus/TargetableEventBus.java b/src/main/java/me/tori/wraith/bus/TargetableEventBus.java
index f44517d..6bc6752 100644
--- a/src/main/java/me/tori/wraith/bus/TargetableEventBus.java
+++ b/src/main/java/me/tori/wraith/bus/TargetableEventBus.java
@@ -25,25 +25,31 @@
import me.tori.wraith.event.targeted.IClassTargetingEvent;
/**
- * @author 7orivorian
- * @since 3.0.0
+ * @author 7orivorian
+ * @since 3.0.0
+ * @deprecated This event bus' functionality is now built into the {@linkplain IEventBus standard event bus}.
*/
+@Deprecated(since = "3.3.0", forRemoval = true)
public interface TargetableEventBus extends IEventBus {
/**
* @param event the {@linkplain IClassTargetingEvent} to dispatch
* @return {@code true} if the given event was {@linkplain IStatusEvent suppressed or terminated} by any listener,
- * {@code false otherwise}
+ * {@code false} otherwise
* @see EventBus#dispatchTargeted(IClassTargetingEvent)
+ * @deprecated This method's functionality is now built into {@link #dispatch(Object)}
*/
+ @Deprecated(since = "3.3.0", forRemoval = true)
boolean dispatchTargeted(IClassTargetingEvent event);
/**
* @param event the {@linkplain IClassTargetingEvent} to dispatch
* @param type the type of listener to invoke (can be {@code null})
* @return {@code true} if the given event was {@linkplain IStatusEvent suppressed or terminated} by any listener,
- * {@code false otherwise}
+ * {@code false} otherwise
* @see EventBus#dispatchTargeted(IClassTargetingEvent, Class)
+ * @deprecated This method's functionality is now built into {@link #dispatch(Object)}
*/
+ @Deprecated(since = "3.3.0", forRemoval = true)
boolean dispatchTargeted(IClassTargetingEvent event, Class> type);
}
\ No newline at end of file
diff --git a/src/main/java/me/tori/wraith/event/cancelable/CancelableEvent.java b/src/main/java/me/tori/wraith/event/cancelable/CancelableEvent.java
deleted file mode 100644
index ae3f539..0000000
--- a/src/main/java/me/tori/wraith/event/cancelable/CancelableEvent.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2021-2024 7orivorian.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package me.tori.wraith.event.cancelable;
-
-import me.tori.wraith.event.status.StatusEvent;
-
-import static me.tori.wraith.event.status.IStatusEvent.EventStatus.SUPPRESSED;
-
-/**
- * Default implementation of the {@link ICancelableEvent} interface.
- *
- * @author 7orivorian
- * @see ICancelableEvent
- * @since 1.0.0
- */
-@Deprecated(forRemoval = true, since = "3.2.0")
-public class CancelableEvent extends StatusEvent implements ICancelableEvent {
-
- @Override
- public String toString() {
- return "Cancelable{" +
- "canceled=" + (getEventStatus() == SUPPRESSED) +
- '}';
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/tori/wraith/event/cancelable/ICancelableEvent.java b/src/main/java/me/tori/wraith/event/cancelable/ICancelableEvent.java
deleted file mode 100644
index 13b14ea..0000000
--- a/src/main/java/me/tori/wraith/event/cancelable/ICancelableEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2021-2024 7orivorian.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-package me.tori.wraith.event.cancelable;
-
-import me.tori.wraith.event.status.IStatusEvent;
-
-/**
- * @author 7orivorian
- * @see CancelableEvent
- * @since 1.0.0
- * @deprecated Use {@link IStatusEvent} instead.
- */
-@Deprecated(forRemoval = true, since = "3.2.0")
-public interface ICancelableEvent extends IStatusEvent {
-
- /**
- * @return {@code true} if this event is canceled, {@code false} otherwise
- * @see #isSuppressed()
- */
- default boolean isCanceled() {
- return isSuppressed();
- }
-
- /**
- * @see #setSuppressed(boolean)
- */
- default void setCanceled(boolean canceled) {
- setSuppressed(canceled);
- }
-
- /**
- * @see #suppress()
- */
- default void cancel() {
- suppress();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/me/tori/wraith/event/targeted/IClassTargetingEvent.java b/src/main/java/me/tori/wraith/event/targeted/IClassTargetingEvent.java
index 5700c91..413e57a 100644
--- a/src/main/java/me/tori/wraith/event/targeted/IClassTargetingEvent.java
+++ b/src/main/java/me/tori/wraith/event/targeted/IClassTargetingEvent.java
@@ -34,10 +34,40 @@
*/
public interface IClassTargetingEvent {
+ /**
+ * Determines if a listener is targeted by a specific event.
+ *
+ * This method checks if the given event is not an instance of {@code IClassTargetingEvent}
+ * or, if it is, delegates the check to the {@code isListenerTargeted} method of the event.
+ *
+ * @param listener the listener to check
+ * @param event the event to check against
+ * @return {@code true} if the event targets the listener, {@code false} otherwise.
+ * @since 3.3.0
+ */
+ static boolean isListenerTargetedByEvent(Listener> listener, Object event) {
+ return !(event instanceof IClassTargetingEvent e)
+ || e.isListenerTargeted(listener);
+ }
+
/**
* Retrieves the target class of listeners for this event.
*
* @return The class that represents the type of listeners targeted by this event.
*/
Class extends Listener>> getTargetClass();
+
+ /**
+ * Checks if the listener is an instance of the target class of this event.
+ *
+ * This default method verifies if the provided listener is an instance of the class
+ * that the event targets by using the {@code getTargetClass} method.
+ *
+ * @param listener the listener to check
+ * @return {@code true} if the listener is an instance of the target class, {@code false} otherwise.
+ * @since 3.3.0
+ */
+ default boolean isListenerTargeted(Listener> listener) {
+ return getTargetClass().isInstance(listener);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/me/tori/wraith/listener/Listener.java b/src/main/java/me/tori/wraith/listener/Listener.java
index cfdb508..5cf68d1 100644
--- a/src/main/java/me/tori/wraith/listener/Listener.java
+++ b/src/main/java/me/tori/wraith/listener/Listener.java
@@ -62,7 +62,7 @@ public interface Listener
+ * This default method evaluates whether the given type is acceptable by comparing it with
+ * the type associated with this listener. It returns {@code true} if any of the following conditions are met:
+ * Usage Example:
* The delay value determines the number of event dispatches that should occur before the task is executed.
* The delay decrements with each event dispatch, and once it becomes less than or equal to 0, the task is executed.
*
- * @author 7orivorian
+ * @author 7orivorian
* @see TaskExecutor
- * @since 3.0.0
+ * @since 3.0.0
*/
public abstract class ScheduledTask implements Runnable {
diff --git a/src/main/test/me/tori/wraith/persistency/PersistencyTest.java b/src/main/test/me/tori/wraith/persistency/PersistencyTest.java
index 1fd050e..56bec70 100644
--- a/src/main/test/me/tori/wraith/persistency/PersistencyTest.java
+++ b/src/main/test/me/tori/wraith/persistency/PersistencyTest.java
@@ -22,7 +22,7 @@
package me.tori.wraith.persistency;
import me.tori.wraith.bus.EventBus;
-import me.tori.wraith.event.cancelable.CancelableEvent;
+import me.tori.wraith.event.status.StatusEvent;
import me.tori.wraith.listener.EventListener;
import me.tori.wraith.subscriber.Subscriber;
import org.junit.jupiter.api.Assertions;
@@ -62,7 +62,7 @@ public void testIndefiniteEvent() {
}
}
- public static class MyListener extends EventListener
+ *
+ *
+ * @param type the class type to check for acceptability
+ * @return {@code true} if the type is acceptable, {@code false} otherwise.
+ * @since 3.3.0
+ */
+ default boolean isAcceptableType(Class> type) {
+ return (type == null) || (getType() == null) || (getType() == type);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/me/tori/wraith/listener/ListenerBuilder.java b/src/main/java/me/tori/wraith/listener/ListenerBuilder.java
index bf576c0..2c02670 100644
--- a/src/main/java/me/tori/wraith/listener/ListenerBuilder.java
+++ b/src/main/java/me/tori/wraith/listener/ListenerBuilder.java
@@ -36,7 +36,7 @@
*
* {@code
- * EventListener
*
- * @param