Skip to content

Learning ChatDirector

bluetigeresw edited this page May 10, 2023 · 1 revision

Here's a quick breakdown of what each context is actually doing in your config.yml's.

ChatDirector Waterfall Config

Config can be found at /home/<user>/<waterfallFolder>/plugins/ChatDirector/config.yml

This part of ChatDirector links Minecraft server with Discord.

Note: ChatDirector works the same way on all servers so for simplicity I will only give examples for how you might do this for Survival and that process can be applied the same way to all other servers.

Setting bot tokens

You can choose for each server which token you want ChatDirector to use. You can either use the same bot for everything or mix it up if you desire.

module_data:
    discord:
        network: "<token goes here>"
        survival: "<token goes here>"
  • network = Bungee

Saving config changes

To apply any config changes to the bot you need to do the command chatdirector reload either from Bungee console or ingame.

Network Connection Messages

    - discord-connection-messages:
        - bungee-input:
            logout: true
            switch-servers: true
            login: true
            format-logout: "&0[&4<-&0] &e%PLAYER_NAME% has left the network from %SERVER_NAME%"
        - regex:
            - "survival" : "Survival"
  • bungee input - Here we're controlling whether we want ChatDirector to do anything on different Bungee connection events (true = yes, false = no)
  • logout - Broadcast when a player disconnects?
  • switch-servers - Broadcast when a player switches to another server on the network?
  • login - Broadcast when a player joins the network?
  • format-logout - Format to use in message when player disconnects
  • regex - Bungee stores server name lowercase so we use regex to capitalize in disconnect message

Colors Command

Simple command to show color codes ingame

    - colors:
        - bungee-command:
            command: "colors"
            permission: "chatdirector.commands.colors"
        - echo: "§1&1§2&2§3&3§4&4§5&5§6&6§7&7§8&8§9&9§0&0§a&a§b&b§c&c§d&d§e&e§f&f§k&k§r&k§l&l§r§m&m§r§n&n§r§o&o§r&r"
        - bungee-output-player:
            player: "%PLAYER_UUID%"
  • Pretty straight forward, bungee-output-player outputs message to player

Servers Command

You need to update this when a new server is added. {.is-info}

This will list our servers and shops with text that pops up when you hover over the message in chat.

    - servers:
        - bungee-command:
            command: "servers"
            permission: "chatdirector.commands.servers"
        - bungee-output-fancy:
            permission: null
            player: "%PLAYER_UUID%"
            fancy-message:
                - color:
                    color: "YELLOW"
                    text: 
                        - raw:
                            text: "Our Servers:\n"
                        - raw:
                            text: "- Survival: "
                        - hover:
                            show-text: "Click to Join"
                            text:
                                - click:
                                    click-run-command: "/server survival"
                                    text: "§b/survival"
                        - color:
                            color: "BLUE"
                            text: " mc.superfuntime.org"
                        - raw:
                            text: "\n"
                        - raw:
                            text: "Premium Shops: "
                        - hover:
                            show-text: "Click for Link"
                            text:
                                - click:
                                    click-url: "https://sftmc.org/shops"
                                    text: "§bsftmc.org/shops"
                        - color:
                            color: "YELLOW"
                            text: " Cosmetic Perks"
  • bungee-command - Creates command /servers with the permission "chatdirector.commands.servers" at the Bungee level
  • bungee-output-fancy - We're gonna set a custom way to output text
  • raw - For each line of text we use raw followed by a \n at the end of the text line to (\n means start new line)
  • hover - Here we specify what text to show when we hover the message in chat. (show-text)
  • click - Here we tell the bot what to do when we click the message in chat. Note that we can either use click-url or click-run-command. In the text underneath we choose what message we display for the player to click to perform this action.
  • The in the last line we add an addendum to the end of the line of text to either explain what the link is or state the given server's ip.

ChatDirector Server Level Config

Config can be found at /home/<user>/<serverFolder>/plugins/ChatDirector/config.yml

Server Status & Bungee Channel

This is where we will set start/stop messages and determine where the server feeds to main or dev bungee channels.

    - status-messages:
        - bukkit-input:
            server-started: true
            server-stopped: true
        - if-contains:
            contains: "Started"
            yes-chain:
                - echo: "**Survival has Started!**"
            no-chain:
                - echo: "**Survival has Stopped!**"
        - file-output:
            path: /var/run/ChatDirector/server-status.sock
  • bukkit-input - Here we tell the plugin where to broadcast server start/stop messages for this server (true/false)
  • if-contains - Checks if server has started or stopped. You will need to change the echo message here to the name of whatever server you're editing!
  • file-output - Where should we send status message? Leave as is if using main bungee. (Change to /var/run/ChatDirector/server-status-dev.sock if running on the Dev bungee).

Local Chat

Here we set the format of ingame chat.

    - local-chat:
        - bukkit-input:
            chat: true
            cancel-chat: false
            override-chat: true
        - vault-context: null
        - echo: "%PLAYER_PREFIX%%PLAYER_NAME%%PLAYER_SUFFIX%: %CHAT_MESSAGE%"
        - regex:
             - "%item%": "|item|"
             - "\\|item\\|": "%item%"
        - resolve-colors: null
  • bukkit-input - Should ChatDirector override the main ingame chat format? (true/false)
  • vault-context - Read information from vault
  • echo - Here we use placeholders to set the ingame chat format
  • regex - Rules for resolving chat formatting of received discord messages
  • resolve-colors - This tells the bot the colors to set each discord chat message in when they're sent to ingame chat

Prefix Sync

This syncs ingame prefixes to discord bot.

    - prefix-sync:
        - bukkit-input:
            login: true
        - vault-context: null
        - send-data:
            table: "suffix"
            name: "%PLAYER_UUID%"
            key: "survival"
            value: "%PLAYER_SUFFIX%"
            connection: "all"
            cache: true
        - send-data:
            table: "prefix"
            name: "%PLAYER_UUID%"
            key: "survival"
            value: "%PLAYER_PREFIX%"
            connection: "all"
            cache: true
  • vault-context - Read information from vault
  • key - The key (name of server) we will store player info under in DB, must be changed for each server.