mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-25 12:16:00 +01:00
Updated TaskBuilder (markdown)
parent
6e47884b40
commit
77264b10a3
@ -23,12 +23,13 @@ new TaskBuilder()
|
||||
### SplitTask example
|
||||
Split up a task and run it when the main thread is free.
|
||||
```Java
|
||||
//In reality you'd use one of FAWE's async world manipulators (EditSession, AsyncWorld, FaweQueue etc.)
|
||||
// In reality you'd use one of EditSession, AsyncWorld, FaweQueue instead.
|
||||
// But this is just an example of how you can split up a task with the FAWE API
|
||||
|
||||
final World world = Bukkit.getWorld("world");
|
||||
new TaskBuilder()
|
||||
.syncWhenFree(new TaskBuilder.SplitTask(20) { // Execution will be split into multiple 20ms tasks
|
||||
// Execution will be split into multiple 20ms tasks
|
||||
.syncWhenFree(new TaskBuilder.SplitTask(20) {
|
||||
@Override
|
||||
public Object exec(Object previous) {
|
||||
for (int x = 0; x < 100; x++) {
|
||||
@ -36,6 +37,7 @@ new TaskBuilder()
|
||||
for (int z = 0; z < 100; z++) {
|
||||
world.getBlockAt(x, y, z).setType(Material.STONE);
|
||||
// FAWE will use this point to split the task
|
||||
// You can have multiple split points
|
||||
split();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user