4
0
Fork 0
mirror of https://github.com/Anvilcraft/modpacktools synced 2024-06-11 06:59:28 +02:00
modpacktools/src/main/kotlin/ley/anvil/modpacktools/command/CommandReturn.kt
LordMZTE a5d5562d93 improve docs
remove mergeTo function due to stdlib containing alternative
getModMetas now takes predicate
2020-08-15 20:49:29 +02:00

27 lines
805 B
Kotlin

package ley.anvil.modpacktools.command
data class CommandReturn constructor(val ret: String?, val success: Boolean) {
companion object {
/**
* Get a failed [CommandReturn]. This should be used if something went wrong
*
* @param ret the error message
* @return the [CommandReturn]
*/
@JvmStatic
@JvmOverloads
fun fail(ret: String? = null) = CommandReturn(ret, false)
/**
* Get a successful [CommandReturn]. Use this if the command was executed successfully
*
* @param ret a return message
* @return the [CommandReturn]
*/
@JvmStatic
@JvmOverloads
fun success(ret: String? = null) = CommandReturn(ret, true)
}
fun hasRet() = ret != null
}