Created
December 30, 2015 23:25
-
-
Save WesJD/d3dc7dcd1770e302fe7f to your computer and use it in GitHub Desktop.
Execute things on the main thread easily.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class MainThreadExecutor { | |
public MainThreadExecutor() { | |
MinecraftServer.getServer().processQueue.add(new Runnable() { | |
@Override | |
public void run() { | |
call(); | |
} | |
}); | |
} | |
public abstract void call(); | |
} |
@airidas338 I actually never thought of that, but this is a little more informative in a multi-threaded environment. Also, it might possibly be faster since it wouldn't go though the Bukkit scheduler.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be simply replaced by BukkitRunnable.runTask()