Skip to content

Commit

Permalink
Now actually throws an exception when adding block dynamically.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dummyc0m committed Oct 12, 2016
1 parent fef5ecd commit 94a8565
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,29 @@ abstract class KobaltForge : OpMode() {
fun onLoopInit(block: () -> Unit) {
if (notStarted)
loopInit.offer(block)
else
throw IllegalAccessException("Adding blocks after init")
}

fun onInit(block: () -> Unit) {
if (notStarted)
init.offer(block)
else
throw IllegalAccessException("Adding blocks after init")
}

fun onStart(block: () -> Unit) {
if (notStarted)
start.offer(block)
else
throw IllegalAccessException("Adding blocks after init")
}

fun onStop(block: () -> Unit) {
if (notStarted)
stop.offer(block)
else
throw IllegalAccessException("Adding blocks after init")
}

final override fun init_loop() {
Expand Down

0 comments on commit 94a8565

Please sign in to comment.