Try this:
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
instead of this:
Bukkit.getScheduler().runTaskLater(plugin, new Runnable(){
runTaskLater
is actually scheduling an Asynchronous task, you should try to always use Synchronous tasks.
The problem with using Asynchronous tasks with Bukkit is your task will be scheduled on another thread, not being in sync with the normal server. Making it so that any Bukkit code that you use is VERY unsafe, so, as a general rule of thumb, whenever you're dealing with Bukkit
, you should always use Synchronous tasks, which will be run on the same thread as your Main
file. So, here's what your scheduled task should look like:
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
public void run(){
loc.getBlock().setType(Aure.blocks.get(loc)); //no need to use loc.getBlock().getLocation(), same thing as just using loc
}
}, 40L);
Same rule applies when trying to create a repeating task, you should use scheduleSyncRepeatingTask
.