mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 16:39:49 +00:00
Utilize a One Thread and Synchronized attribute to better control data integrity and prevent data loss
This commit is contained in:
1 parent
60dbcc7146
commit
ae1f33d327
6 files changed
+78
-45
No files matched your search
@@ -0,0 +1,17 @@
|
||||
package noppes.npcs.util;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class CustomNPCsScheduler {
|
||||
private final static ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
|
||||
|
||||
public static void runTack(Runnable task, int delay){
|
||||
executor.schedule(task, delay, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public static void runTack(Runnable task){
|
||||
executor.schedule(task, 0, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user