feat(multiplayer): auto rejection.
This commit is contained in:
@@ -26,8 +26,7 @@ import java.util.Collections;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static org.jackhuang.hmcl.util.Lang.rethrow;
|
||||
import static org.jackhuang.hmcl.util.Lang.wrap;
|
||||
import static org.jackhuang.hmcl.util.Lang.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -320,13 +319,6 @@ public final class AsyncTaskExecutor extends TaskExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
private static Throwable resolveException(Throwable e) {
|
||||
if (e instanceof ExecutionException || e instanceof CompletionException)
|
||||
return resolveException(e.getCause());
|
||||
else
|
||||
return e;
|
||||
}
|
||||
|
||||
private void checkCancellation() {
|
||||
if (isCancelled()) {
|
||||
throw new CancellationException("Cancelled by user");
|
||||
|
||||
@@ -377,6 +377,13 @@ public final class Lang {
|
||||
return task;
|
||||
}
|
||||
|
||||
public static Throwable resolveException(Throwable e) {
|
||||
if (e instanceof ExecutionException || e instanceof CompletionException)
|
||||
return resolveException(e.getCause());
|
||||
else
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a useful function to prevent exceptions being eaten when using CompletableFuture.
|
||||
* You can write:
|
||||
|
||||
Reference in New Issue
Block a user