feat(multiplayer): an option for auto allowing all join requests. Closes #1093.

This commit is contained in:
huanghongxun
2021-10-07 22:39:02 +08:00
parent 60865163db
commit eedcff785e
9 changed files with 122 additions and 19 deletions

View File

@@ -357,6 +357,22 @@ public final class Lang {
return () -> iterator;
}
private static Timer timer;
public static synchronized TimerTask setTimeout(Runnable runnable, long delayMs) {
if (timer == null) {
timer = new Timer();
}
TimerTask task = new TimerTask() {
@Override
public void run() {
runnable.run();
}
};
timer.schedule(task, delayMs);
return task;
}
/**
* This is a useful function to prevent exceptions being eaten when using CompletableFuture.
* You can write: