Skip to content

RecordUnrestored

class RecordUnrestored : IllegalStateException("the world record $namespace:${collection.substringAfterLast('.')}:$key will not restore ($why); it is kept as stored, and nothing writes over it until it restores (or it is set aside)")
Example
import rift.ecs.Persist
import rift.ecs.Persistent
@Persistent class Banner(@Persist val text: String = "")
on_world_start {
val banners = Game.worldRecords.collection<Banner>()
val banner = try { banners.get("welcome") } catch (e: RecordUnrestored) { Logger.warn(e.message); null }
broadcast(banner?.text ?: "Welcome to the realm.")
}