Add edit backpacks button to /firm storage
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
|
||||
@file:OptIn(ExperimentalContracts::class)
|
||||
|
||||
package moe.nea.firmament.util
|
||||
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
/**
|
||||
* Less aggressive version of `require(obj != null)`, which fails in devenv but continues at runtime.
|
||||
*/
|
||||
inline fun <T : Any> assertNotNullOr(obj: T?, message: String? = null, block: () -> T): T {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
|
||||
}
|
||||
if (message == null)
|
||||
assert(obj != null)
|
||||
else
|
||||
@@ -18,6 +25,9 @@ inline fun <T : Any> assertNotNullOr(obj: T?, message: String? = null, block: ()
|
||||
* Less aggressive version of `require(condition)`, which fails in devenv but continues at runtime.
|
||||
*/
|
||||
inline fun assertTrueOr(condition: Boolean, block: () -> Unit) {
|
||||
contract {
|
||||
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
|
||||
}
|
||||
assert(condition)
|
||||
if (!condition) block()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user