Package org.sgrewritten.stargate.thread
Class SynchronousPopulator
java.lang.Object
org.sgrewritten.stargate.thread.SynchronousPopulator
- All Implemented Interfaces:
Runnable
Cycles through a queue of actions everytime the
run()
function is triggered.
If used with the BukkitScheduler.scheduleSyncRepeatingTask(Plugin, Runnable, long, long)
function, you can use this as a handy way to do synchronous tasks (tasks that happens during a specific tick).
Warning: Running this once, even by running forceDoAllTasks does not guarantee all tasks to finish.
- Author:
- Thorin
-
Constructor Details
-
SynchronousPopulator
public SynchronousPopulator()
-
-
Method Details
-
run
public void run() -
addAction
Adds a populator action to the queue- Parameters:
action
-The action to add
-
addAction
Adds a populator action to the queueActions in the Bungee queue are only performed once the server name is known. If you need this behavior, use isBungee = true. If not, don't use isBungee.
- Parameters:
action
-The action to add
isBungee
-Whether the action relies on the server name being known and should be put in the bungee queue
-
clear
public void clear()Force all populator tasks to be performed and clear the tasks unable to be performed
-