File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/main/kotlin/gg/skytils/skytilsmod/features/impl/handlers Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import gg.skytils.skytilsmod.utils.ObservableSet
2929import net.minecraft.command.ICommand
3030import net.minecraftforge.client.ClientCommandHandler
3131import net.minecraftforge.fml.common.Loader
32+ import net.minecraftforge.fml.common.ModContainer
3233import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
3334
3435/* *
@@ -75,7 +76,7 @@ object NamespacedCommands {
7576 * This method takes a command and registers the command's namespaced version.
7677 */
7778 fun registerCommandHelper (command : ICommand ) {
78- val owners = Loader .instance().modList.filter { command.javaClass.`package`.name in it.ownedPackages }
79+ val owners = getCommandModOwner( command.javaClass)
7980 if (owners.size != 1 ) {
8081 println (" WARNING! Command ${command.commandName} has ${owners.size} ; owners: $owners " )
8182 }
@@ -90,6 +91,11 @@ object NamespacedCommands {
9091 aliasMap[command] = helper
9192 }
9293
94+ fun getCommandModOwner (command : Class <* >) : List <ModContainer > {
95+ val packageName = command.`package`.name ? : return emptyList()
96+ return Loader .instance().modList.filter { packageName in it.ownedPackages }
97+ }
98+
9399 /* *
94100 * Handles the actual sending of the command.
95101 *
You can’t perform that action at this time.
0 commit comments