Skip to content

Commit

Permalink
Prevent invalid commands from blocking Typewriter startup
Browse files Browse the repository at this point in the history
  • Loading branch information
gabber235 committed Nov 20, 2024
1 parent fa62886 commit 42dbebc
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,24 @@ import dev.jorel.commandapi.CommandTree

fun CustomCommandEntry.Companion.registerAll() {
val entries = Query.find<CustomCommandEntry>()
entries.forEach { it.register() }
entries.forEach {
try {
it.register()
} catch (e: Exception) {
e.printStackTrace()
}
}
}

fun CustomCommandEntry.Companion.unregisterAll() {
val entries = Query.find<CustomCommandEntry>()
entries.forEach { it.unregister() }
entries.forEach {
try {
it.unregister()
} catch (e: Exception) {
e.printStackTrace()
}
}
}

fun CustomCommandEntry.register() {
Expand Down

0 comments on commit 42dbebc

Please sign in to comment.