Update readme.md
This commit is contained in:
19
readme.md
19
readme.md
@@ -47,7 +47,8 @@ kSpigot.task(
|
||||
|
||||
// you can access the following counter variables in here
|
||||
println(counterUp) // starting from zero
|
||||
println(counterDown) // starting from howOften
|
||||
println(counterDownToOne) // starting from howOften
|
||||
println(counterDownToZero) // starting from howOften - 1
|
||||
}
|
||||
```
|
||||
NOTE: The counters are nullable, because howOften is (when null) infinite.
|
||||
@@ -56,6 +57,22 @@ NOTE: The counters are nullable, because howOften is (when null) infinite.
|
||||
|
||||
With the `kSpigot.task() { }` method you have the possibility to set the parameter `safe = true`. When doing this, the defined `endCallback` will be executed under any circumstances (except a major server crash). If you define `endCallback`, but do not set `safe = true` the `endCallback` will only be executed when the task ends, because the limit of `howOften` was reached.
|
||||
|
||||
#### Chainable runnabless
|
||||
|
||||
This makes it possible to do resource intensive tasks asynchronous and then doing something with the result synchronous (e.g. because Spigot forces you) in a simple way.
|
||||
|
||||
```kotlin
|
||||
kSpigot.firstAsync {
|
||||
// do a resource intensive task
|
||||
ArrayList<Block>() // -> this will be forwarded to the next part of the chain as "it"
|
||||
}.thenSync {
|
||||
// do something with the result
|
||||
it?.forEach { }
|
||||
}.thenAsync {
|
||||
// and so on...
|
||||
}
|
||||
```
|
||||
|
||||
### Powerful builders
|
||||
|
||||
#### For items
|
||||
|
Reference in New Issue
Block a user