callCancellable style

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2022-06-25 11:24:36 +02:00
parent 9f1fcd89ef
commit 19bb23fe3d

View File

@ -213,7 +213,7 @@ public sealed interface EventNode<T extends Event> permits EventNodeImpl {
*/
default void callCancellable(@NotNull T event, @NotNull Runnable successCallback) {
call(event);
if (!(event instanceof CancellableEvent) || !((CancellableEvent) event).isCancelled()) {
if (!(event instanceof CancellableEvent cancellableEvent) || !cancellableEvent.isCancelled()) {
successCallback.run();
}
}