runOnClient

This commit is contained in:
DBotThePony 2022-09-04 16:06:06 +07:00
parent 6910ee7d33
commit 0d5629ef07
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -142,6 +142,14 @@ fun <V> runIfClient(value: V, lambda: () -> V): V {
return value
}
fun <V> runOnClient(value: V, lambda: () -> V): V {
if (isClientThread()) {
return lambda.invoke()
}
return value
}
fun isServerThread(): Boolean {
return Thread.currentThread() === _serverThread
}