Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
AsyncEventExecutor -> AwaitingEventExecutor
Dieser Commit ist enthalten in:
Ursprung
51f923bf2d
Commit
64d30fba81
@ -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 <E> event type
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface AsyncEventExecutor<E> extends EventHandler<E> {
|
||||
public interface AwaitingEventExecutor<E> extends EventHandler<E> {
|
||||
|
||||
default void execute(E event) {
|
||||
throw new UnsupportedOperationException(
|
@ -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<E> {
|
||||
|
@ -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<Object> buildHandler(final Object targetInstance) {
|
||||
return (AsyncEventExecutor<Object>) event -> execute(targetInstance, event);
|
||||
return (AwaitingEventExecutor<Object>) event -> execute(targetInstance, event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public interface UntargetedEventHandler {
|
||||
|
||||
@Override
|
||||
default EventHandler<Object> buildHandler(final Object targetInstance) {
|
||||
return (AsyncEventExecutor<Object>) event -> {
|
||||
return (AwaitingEventExecutor<Object>) event -> {
|
||||
execute(targetInstance, event);
|
||||
return null;
|
||||
};
|
||||
@ -56,7 +56,7 @@ public interface UntargetedEventHandler {
|
||||
|
||||
@Override
|
||||
default EventHandler<Object> buildHandler(final Object targetInstance) {
|
||||
return (AsyncEventExecutor<Object>) event -> EventTask.withContinuation(continuation ->
|
||||
return (AwaitingEventExecutor<Object>) event -> EventTask.withContinuation(continuation ->
|
||||
execute(targetInstance, event, continuation));
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren