mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-05 23:33:36 +00:00
fancynpcs: Fix tests
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package de.oliver.plugintests.utils;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class Delay {
|
||||
|
||||
private static final ScheduledExecutorService EXECUTOR = Executors.newScheduledThreadPool(10);
|
||||
|
||||
public static void delay(Runnable runnable) {
|
||||
ScheduledFuture<?> f = EXECUTOR.schedule(runnable, 10, TimeUnit.MILLISECONDS);
|
||||
|
||||
try {
|
||||
f.get(100, TimeUnit.MILLISECONDS);
|
||||
} catch (InterruptedException | ExecutionException | TimeoutException e) {
|
||||
System.out.println("Delay interrupted: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user