Rename EventListener#eventType

This commit is contained in:
TheMode 2021-08-19 22:53:20 +02:00
parent 044849b5ac
commit 46d2542d59
2 changed files with 4 additions and 4 deletions

View File

@ -19,7 +19,7 @@ import java.util.function.Predicate;
*/
public interface EventListener<T extends Event> {
@NotNull Class<T> getEventType();
@NotNull Class<T> eventType();
@NotNull Result run(@NotNull T event);
@ -122,7 +122,7 @@ public interface EventListener<T extends Event> {
final var handler = this.handler;
return new EventListener<>() {
@Override
public @NotNull Class<T> getEventType() {
public @NotNull Class<T> eventType() {
return eventType;
}

View File

@ -172,7 +172,7 @@ class EventNodeImpl<T extends Event> implements EventNode<T> {
@Override
public @NotNull EventNode<T> addListener(@NotNull EventListener<? extends T> listener) {
synchronized (GLOBAL_CHILD_LOCK) {
final var eventType = listener.getEventType();
final var eventType = listener.eventType();
var entry = getEntry(eventType);
entry.listeners.add((EventListener<T>) listener);
propagateEvent(eventType);
@ -183,7 +183,7 @@ class EventNodeImpl<T extends Event> implements EventNode<T> {
@Override
public @NotNull EventNode<T> removeListener(@NotNull EventListener<? extends T> listener) {
synchronized (GLOBAL_CHILD_LOCK) {
final var eventType = listener.getEventType();
final var eventType = listener.eventType();
var entry = listenerMap.get(eventType);
if (entry == null) return this;
var listeners = entry.listeners;