This commit is contained in:
kento2 2026-07-05 03:06:15 +02:00
parent ea6ae529cc
commit 7040a6ce1e
20 changed files with 135 additions and 83 deletions

View file

@ -23,9 +23,9 @@ dependencies {
// https://mvnrepository.com/artifact/io.nats/jnats
api("io.nats:jnats:2.25.2")
// http://forge.kentoj.de/scrow/-/packages/maven/de.kentoj.scrow:kencommandapi-core
api("de.kentoj.scrow:kencommandapi-core:0.28")
api("de.kentoj.scrow:kencommandapi-core:0.30")
// http://forge.kentoj.de/scrow/-/packages/maven/de.kentoj.scrow:kencommandapi-bukkit
api("de.kentoj.scrow:kencommandapi-bukkit:0.28")
api("de.kentoj.scrow:kencommandapi-bukkit:0.30")
}
publishing {

View file

@ -1,6 +1,5 @@
package de.kentoj.scrow.bukkit.friends;
import com.google.common.base.Preconditions;
import lombok.Getter;
import java.util.UUID;
@ -11,7 +10,6 @@ public class OrderedUUIDPair {
private final UUID second;
public OrderedUUIDPair(UUID uuid1, UUID uuid2) {
Preconditions.checkArgument(uuid1 != uuid2, "UUIDPair may consist of identical UUIDs");
if (uuid1.compareTo(uuid2) < 0) {
this.first = uuid1;
this.second = uuid2;

View file

@ -1,22 +1,16 @@
package de.kentoj.scrow.bukkit.scheduler;
import com.google.common.base.Preconditions;
import de.kentoj.scrow.bukkit.ScrowAPI;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.bukkit.Bukkit;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.*;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import static com.google.common.base.Preconditions.*;
/**
* A Task runs entirely async, when sync is used, a subtask is run on the main thread and the async thread
* blocks until the subtask returns.
@ -34,7 +28,14 @@ public class TaskImpl<T> implements Task<T> {
@Override
public CompletableFuture<T> toFuture() {
return CompletableFuture.supplyAsync(() -> state().getValue(), EXECUTOR);
return CompletableFuture.supplyAsync(() -> {
try {
return state().getValue();
} catch (Exception ex) {
log.error("failed completing future", ex);
throw new CompletionException(ex);
}
}, EXECUTOR);
}
/**