Search in sources :

Example 1 with ChatFormatterRegistry

use of io.github.darkkronicle.advancedchatbox.registry.ChatFormatterRegistry in project AdvancedChatBox by DarkKronicle.

the class ChatBoxInitHandler method registerModHandlers.

@Override
public void registerModHandlers() {
    ConfigManager.getInstance().registerConfigHandler(AdvancedChatBox.MOD_ID, new ChatBoxConfigStorage());
    GuiConfigHandler.getInstance().addTab(GuiConfigHandler.children("box", "advancedchat.config.tab.advancedchatbox", GuiConfigHandler.wrapScreen("box_general", "advancedchatbox.config.tab.general", parent -> new GuiChatBoxConfig()), GuiConfigHandler.wrapSaveableOptions("spellchecker", "advancedchatbox.config.tab.spellchecker", ChatBoxConfigStorage.SpellChecker.OPTIONS)));
    ChatFormatterRegistry chatRegistry = ChatFormatterRegistry.getInstance();
    chatRegistry.register(CommandColorer::getInstance, "commandcolorer", "advancedchatbox.config.chatformatter.commandcolorer", "advancedchatbox.config.chatformatter.info.commandcolorer", true, true);
    chatRegistry.register(JSONFormatter::new, "jsonformatter", "advancedchatbox.config.chatformatter.jsonformatter", "advancedchatbox.config.chatformatter.info.jsonformatter", true, false);
    chatRegistry.register(ColorCodeFormatter::new, "colorcodeformatter", "advancedchatbox.config.chatformatter.colorcodeformatter", "advancedchatbox.config.chatformatter.info.colorcodeformatter", true, false);
    // Initiate chat suggestors
    ChatSuggestorRegistry suggestorRegistry = ChatSuggestorRegistry.getInstance();
    suggestorRegistry.register(PlayerSuggestor::new, "players", "advancedchatbox.config.chatsuggestor.players", "advancedchatbox.config.chatsuggestor.info.players", true, false);
    suggestorRegistry.register(CalculatorSuggestor::new, "calculator", "advancedchatbox.config.chatsuggestor.calculator", "advancedchatbox.config.chatsuggestor.info.calculator", true, false);
    suggestorRegistry.register(ShortcutSuggestor::new, "shortcut", "advancedchatbox.config.chatsuggestor.shortcut", "advancedchatbox.config.chatsuggestor.info.shortcut", true, false);
    try {
        suggestorRegistry.register(SpellCheckSuggestor::getInstance, "spellcheck", "advancedchatbox.config.chatsuggestor.spellcheck", "advancedchatbox.config.chatsuggestor.info.spellcheck", true, false);
    } catch (Exception e) {
        LogManager.getLogger().log(Level.ERROR, "[AdvancedChat] {}", "Couldn't load SpellCheckSuggestor", e);
    }
    AdvancedChatCore.CREATE_SUGGESTOR = false;
    ChatScreenSectionHolder.getInstance().addSectionSupplier(ChatBoxSection::new);
}
Also used : CommandColorer(io.github.darkkronicle.advancedchatbox.formatter.CommandColorer) ColorCodeFormatter(io.github.darkkronicle.advancedchatbox.formatter.ColorCodeFormatter) CalculatorSuggestor(io.github.darkkronicle.advancedchatbox.suggester.CalculatorSuggestor) SpellCheckSuggestor(io.github.darkkronicle.advancedchatbox.suggester.SpellCheckSuggestor) ChatBoxConfigStorage(io.github.darkkronicle.advancedchatbox.config.ChatBoxConfigStorage) GuiChatBoxConfig(io.github.darkkronicle.advancedchatbox.config.GuiChatBoxConfig) ChatBoxSection(io.github.darkkronicle.advancedchatbox.chat.ChatBoxSection) ChatSuggestorRegistry(io.github.darkkronicle.advancedchatbox.registry.ChatSuggestorRegistry) PlayerSuggestor(io.github.darkkronicle.advancedchatbox.suggester.PlayerSuggestor) ChatFormatterRegistry(io.github.darkkronicle.advancedchatbox.registry.ChatFormatterRegistry) JSONFormatter(io.github.darkkronicle.advancedchatbox.formatter.JSONFormatter) ShortcutSuggestor(io.github.darkkronicle.advancedchatbox.suggester.ShortcutSuggestor)

Aggregations

ChatBoxSection (io.github.darkkronicle.advancedchatbox.chat.ChatBoxSection)1 ChatBoxConfigStorage (io.github.darkkronicle.advancedchatbox.config.ChatBoxConfigStorage)1 GuiChatBoxConfig (io.github.darkkronicle.advancedchatbox.config.GuiChatBoxConfig)1 ColorCodeFormatter (io.github.darkkronicle.advancedchatbox.formatter.ColorCodeFormatter)1 CommandColorer (io.github.darkkronicle.advancedchatbox.formatter.CommandColorer)1 JSONFormatter (io.github.darkkronicle.advancedchatbox.formatter.JSONFormatter)1 ChatFormatterRegistry (io.github.darkkronicle.advancedchatbox.registry.ChatFormatterRegistry)1 ChatSuggestorRegistry (io.github.darkkronicle.advancedchatbox.registry.ChatSuggestorRegistry)1 CalculatorSuggestor (io.github.darkkronicle.advancedchatbox.suggester.CalculatorSuggestor)1 PlayerSuggestor (io.github.darkkronicle.advancedchatbox.suggester.PlayerSuggestor)1 ShortcutSuggestor (io.github.darkkronicle.advancedchatbox.suggester.ShortcutSuggestor)1 SpellCheckSuggestor (io.github.darkkronicle.advancedchatbox.suggester.SpellCheckSuggestor)1