mirror of
https://github.com/amalthea-mc/spigot-tg-bridge.git
synced 2024-11-23 10:52:26 +00:00
Cancel and join parent job
This commit is contained in:
parent
8279fc9022
commit
df7accf52d
@ -5,6 +5,8 @@ import kotlinx.coroutines.Dispatchers
|
|||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
|
import kotlinx.coroutines.Job
|
||||||
|
import kotlinx.coroutines.cancelAndJoin
|
||||||
import org.bukkit.plugin.java.JavaPlugin
|
import org.bukkit.plugin.java.JavaPlugin
|
||||||
|
|
||||||
open class AsyncJavaPlugin : JavaPlugin() {
|
open class AsyncJavaPlugin : JavaPlugin() {
|
||||||
@ -17,7 +19,7 @@ open class AsyncJavaPlugin : JavaPlugin() {
|
|||||||
override fun onDisable() {
|
override fun onDisable() {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
onDisableAsync()
|
onDisableAsync()
|
||||||
scope.cancel()
|
scope.coroutineContext[Job]?.cancelAndJoin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user