From 64d30fba81baa4a54e9e942375a4c2e33e553d73 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sun, 23 May 2021 17:51:07 -0400 Subject: [PATCH] AsyncEventExecutor -> AwaitingEventExecutor --- ...AsyncEventExecutor.java => AwaitingEventExecutor.java} | 7 ++++++- .../java/com/velocitypowered/api/event/EventHandler.java | 5 ++--- .../proxy/event/UntargetedEventHandler.java | 8 ++++---- .../velocitypowered/proxy/event/VelocityEventManager.java | 1 - 4 files changed, 12 insertions(+), 9 deletions(-) rename api/src/main/java/com/velocitypowered/api/event/{AsyncEventExecutor.java => AwaitingEventExecutor.java} (75%) diff --git a/api/src/main/java/com/velocitypowered/api/event/AsyncEventExecutor.java b/api/src/main/java/com/velocitypowered/api/event/AwaitingEventExecutor.java similarity index 75% rename from api/src/main/java/com/velocitypowered/api/event/AsyncEventExecutor.java rename to api/src/main/java/com/velocitypowered/api/event/AwaitingEventExecutor.java index cd4e72141..da1510c3d 100644 --- a/api/src/main/java/com/velocitypowered/api/event/AsyncEventExecutor.java +++ b/api/src/main/java/com/velocitypowered/api/event/AwaitingEventExecutor.java @@ -9,8 +9,13 @@ package com.velocitypowered.api.event; import org.checkerframework.checker.nullness.qual.Nullable; +/** + * An event handler that returns an {@link EventTask} to await on. + * + * @param event type + */ @FunctionalInterface -public interface AsyncEventExecutor extends EventHandler { +public interface AwaitingEventExecutor extends EventHandler { default void execute(E event) { throw new UnsupportedOperationException( diff --git a/api/src/main/java/com/velocitypowered/api/event/EventHandler.java b/api/src/main/java/com/velocitypowered/api/event/EventHandler.java index c18ea098d..ddbcf5d3b 100644 --- a/api/src/main/java/com/velocitypowered/api/event/EventHandler.java +++ b/api/src/main/java/com/velocitypowered/api/event/EventHandler.java @@ -11,9 +11,8 @@ import org.checkerframework.checker.nullness.qual.Nullable; /** * Represents an interface to perform direct dispatch of an event. This makes integration easier to - * achieve with platforms such as RxJava. While this interface can be used to implement an - * asynchronous event handler, {@link AsyncEventExecutor} provides a more idiomatic means of doing - * so. + * achieve with platforms such as RxJava. While this interface can be used to implement an awaiting + * event handler, {@link AwaitingEventExecutor} provides a more idiomatic means to doing so. */ @FunctionalInterface public interface EventHandler { diff --git a/proxy/src/main/java/com/velocitypowered/proxy/event/UntargetedEventHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/event/UntargetedEventHandler.java index 6bf098214..614f84da9 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/event/UntargetedEventHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/event/UntargetedEventHandler.java @@ -17,7 +17,7 @@ package com.velocitypowered.proxy.event; -import com.velocitypowered.api.event.AsyncEventExecutor; +import com.velocitypowered.api.event.AwaitingEventExecutor; import com.velocitypowered.api.event.Continuation; import com.velocitypowered.api.event.EventHandler; import com.velocitypowered.api.event.EventTask; @@ -33,7 +33,7 @@ public interface UntargetedEventHandler { @Override default EventHandler buildHandler(final Object targetInstance) { - return (AsyncEventExecutor) event -> execute(targetInstance, event); + return (AwaitingEventExecutor) event -> execute(targetInstance, event); } } @@ -43,7 +43,7 @@ public interface UntargetedEventHandler { @Override default EventHandler buildHandler(final Object targetInstance) { - return (AsyncEventExecutor) event -> { + return (AwaitingEventExecutor) event -> { execute(targetInstance, event); return null; }; @@ -56,7 +56,7 @@ public interface UntargetedEventHandler { @Override default EventHandler buildHandler(final Object targetInstance) { - return (AsyncEventExecutor) event -> EventTask.withContinuation(continuation -> + return (AwaitingEventExecutor) event -> EventTask.withContinuation(continuation -> execute(targetInstance, event, continuation)); } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java b/proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java index a1d817d95..212acd166 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/event/VelocityEventManager.java @@ -26,7 +26,6 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; import com.google.common.reflect.TypeToken; import com.google.common.util.concurrent.ThreadFactoryBuilder; -import com.velocitypowered.api.event.AsyncEventExecutor; import com.velocitypowered.api.event.Continuation; import com.velocitypowered.api.event.EventHandler; import com.velocitypowered.api.event.EventManager;