Skip to content

Commit

Permalink
fix: handle commands with no package defined
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Apr 27, 2024
1 parent 736b05f commit d4101aa
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ object NamespacedCommands {
val owner = owners.firstOrNull()

val prefix = owner?.modId ?: owner?.name ?: "unknown"

val helper = "${prefix}:${command.commandName}"
cch.commandMap[helper] = command

aliasMap[command] = helper
}

fun getCommandModOwner(command: Class<*>) : List<ModContainer> {
val packageName = command.`package`.name ?: return emptyList()
val idx = command.name.lastIndexOf(".")
if (idx == -1) return emptyList()
val packageName = command.name.substring(0, idx)
return Loader.instance().modList.filter { packageName in it.ownedPackages }
}

Expand Down

0 comments on commit d4101aa

Please sign in to comment.