You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jesse Boyd edited this page Nov 1, 2016
·
2 revisions
Async task
Pretty basic stuff, but this is how you run an async task with the FAWE TaskManager
TaskManager.IMP.async(newRunnable() {
@Overridepublicvoidrun() {
// Do stuff here?
}
});
Sync task
With the FAWE TaskManager to you can switch to the main thread (from an async one) and run a task.
// Get a player's inventory from an async thread// E.g. if the method isn't safe to use asyncPlayerInventoryinventory = TaskManager.IMP.sync(newRunnableVal<PlayerInventory>() {
@Overridepublicvoidrun(PlayerInventoryvalue) {
this.value = player.getInventory();
}
});
When to do this?
The method you want to call isn't safe to use async
The are performance issues with doing the task async