mcchat

Country + frequency chat channels for Paper/Folia. Players only see messages from others in the same channel.

paper / folia sqlite storage in-memory cache channel filtering

overview

what it does

mcchat separates global chat into channels based on two player settings: country and frequency. When a player chats, only recipients in the same country and frequency will receive that message.

defaults

country
WW
frequency
1

how it works

join initialization

On player join, mcchat ensures the player has a record in the database and then loads their country/frequency into an in-memory cache.

event: PlayerJoinEvent
handler: HandlePlayerJoinInitData
provider: MCChatProvider.initPlayerData(uuid) (async)

chat filtering

On chat, mcchat reads sender + recipient channel data from cache and removes any recipients not matching the sender's channel.

event: AsyncPlayerChatEvent
handler: HandleChatFilter
rule: same country AND same frequency
Performance note: chat handling uses cached lookups (no database queries during chat). Filtering cost is proportional to online recipients.

commands

/chat help

Shows the help menu.

/chat help

/chat set

Sets your country or frequency.

/chat set country TH
/chat set frequency 1
permission
none
country format
2-letter ISO uppercase
frequency format
positive integer

chat format

Messages are displayed with channel context:

[country][frequency][player] message

Color formatting (defaults):

country
red
frequency
sky blue
player
dark gray

All formatting is configurable via config.yml:

chat:
  format: "[{country}][{frequency}][{player}] {message}"
  colors:
    country: "&c"
    frequency: "&b"
    player: "&8"
    message: "&f"

Available placeholders:

{country}
{frequency}
{player}
{message}

localization

Player-facing messages are sent using Component.translatable with the base key mcengine.mcchat.

Language JSON files are included under resources/lang/.