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

kr.summitsystems.springbukkit.command.CommandContextImpl.kt Maven / Gradle / Ivy

The newest version!
package kr.summitsystems.springbukkit.command

import kr.summitsystems.springbukkit.core.util.extension.getLocale
import org.bukkit.command.CommandSender

internal class CommandContextImpl(
    override val sender: T,
    override val label: String,
    private val registrableCommandMapping: RegistrableCommandMapping,
    private val commandMappingRegistry: CommandMappingRegistry,
    private val commandFeedbackSource: CommandFeedbackSource,
    private val parameters: Map
) : CommandContext {
    override fun sendUsage() {
        sender.sendMessage(commandFeedbackSource.getUsageMessage(registrableCommandMapping, sender.getLocale()))
    }

    override fun sendUsageAll() {
        commandMappingRegistry
            .findAllByRoot(registrableCommandMapping.qualifier.split(".").first())
            .forEach { mapping ->
                sender.sendMessage(commandFeedbackSource.getUsageMessage(mapping, sender.getLocale()))
            }
    }

    override fun getParameters(): Map {
        return parameters
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy