All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.freya02.botcommands.internal.commands.mixins.INamedCommand.kt Maven / Gradle / Ivy

package com.freya02.botcommands.internal.commands.mixins

import com.freya02.botcommands.api.commands.CommandPath

interface INamedCommand {
    val parentInstance: INamedCommand?

    val name: String
    val path: CommandPath

    companion object {
        fun INamedCommand.computePath(): CommandPath {
            val components: MutableList = arrayListOf()
            var info = this

            do {
                components += info.name
                info = info.parentInstance ?: break
            } while (true)

            return CommandPath.of(*components.also { it.reverse() }.toTypedArray())
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy