<commit_before>package de.axelrindle.broadcaster.command

import de.axelrindle.broadcaster.Broadcaster
import de.axelrindle.pocketknife.PocketCommand
import de.axelrindle.pocketknife.util.ChatUtils.formatColors
import de.axelrindle.pocketknife.util.sendMessageF
import org.bukkit.command.CommandExecutor
import org.bukkit.command.CommandSender
import de.axelrindle.broadcaster.Broadcaster.Companion.CHAT_PREFIX

/**
 * The main [CommandExecutor] for the plugin.
 */
class BrcCommand(
        private val plugin: Broadcaster
) : PocketCommand() {

    override fun getName(): String {
        return "brc"
    }

    override fun getDescription(): String {
        return plugin.localization.localize("CommandHelp.Brc")!!
    }

    override fun getSubCommands(): ArrayList<PocketCommand> {
        return arrayListOf(
                StartCommand(plugin),
                StopCommand(plugin),
                ReloadCommand(plugin),
                CastCommand(plugin),
                StatusCommand(plugin)
        )
    }

    override fun messageNoPermission(): String {
        return formatColors(plugin.localization.localize("NoPermission")!!)
    }

    override fun sendHelp(sender: CommandSender) {
        val helpText = plugin.localization.localize("Words.Help")!!
        sender.sendMessageF(CHAT_PREFIX + helpText)
        var i = 0
        if (sender.hasPermission("broadcaster.brc")) {
            sender.sendMessageF("&9/${getName()} &f- &3${getDescription()}")
            i++
        }
        getSubCommands().forEach {
            if (it.getPermission() == null || sender.hasPermission(it.getPermission()!!)) {
                it.sendHelp(sender)
                i++
            }
        }

        // nothing sent, send no permission message
        if (i == 0) sender.sendMessage(messageNoPermission())
    }<commit_msg>Replace getSubCommands() with a class attribute<commit_after>package de.axelrindle.broadcaster.command

import de.axelrindle.broadcaster.Broadcaster
import de.axelrindle.pocketknife.PocketCommand
import de.axelrindle.pocketknife.util.ChatUtils.formatColors
import de.axelrindle.pocketknife.util.sendMessageF
import org.bukkit.command.CommandExecutor
import org.bukkit.command.CommandSender
import de.axelrindle.broadcaster.Broadcaster.Companion.CHAT_PREFIX

/**
 * The main [CommandExecutor] for the plugin.
 */
class BrcCommand(
        private val plugin: Broadcaster
) : PocketCommand() {

    private val subCommands = arrayListOf(
            StartCommand(plugin),
            StopCommand(plugin),
            ReloadCommand(plugin),
            CastCommand(plugin),
            StatusCommand(plugin)
    )

    override fun getName(): String {
        return "brc"
    }

    override fun getDescription(): String {
        return plugin.localization.localize("CommandHelp.Brc")!!
    }

    override fun getSubCommands(): ArrayList<PocketCommand> = subCommands

    override fun messageNoPermission(): String {
        return formatColors(plugin.localization.localize("NoPermission")!!)
    }

    override fun sendHelp(sender: CommandSender) {
        val helpText = plugin.localization.localize("Words.Help")!!
        sender.sendMessageF(CHAT_PREFIX + helpText)
        var i = 0
        if (sender.hasPermission("broadcaster.brc")) {
            sender.sendMessageF("&9/${getName()} &f- &3${getDescription()}")
            i++
        }
        getSubCommands().forEach {
            if (it.getPermission() == null || sender.hasPermission(it.getPermission()!!)) {
                it.sendHelp(sender)
                i++
            }
        }

        // nothing sent, send no permission message
        if (i == 0) sender.sendMessage(messageNoPermission())
    }
{'fraction_non_alphanumeric': 0.10818083961248655, 'fraction_numerical': 0.002152852529601722, 'mean_word_length': 2.7545454545454544, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7659451', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1013, 'n_words': 194}