mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-02 14:38:26 +01:00
Rename EventListener#eventType
This commit is contained in:
parent
044849b5ac
commit
46d2542d59
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user