Skip to content

Style your chat as you want! (Server side, Fabric)

License

Notifications You must be signed in to change notification settings

YabkoMC/LocalStyledChat

 
 

Repository files navigation

Local Styled Chat

This is fork of StyledChat with local (range-limited) chat channel. Not addon!

It requires PlayerAbilityLib

It's a simple mod that allows server owners to change how their chat looks!

It adds support for modern chat formatting supported by Minecraft, but ignored by many chat mods/plugins.

It's also compatible with any mods using Placeholder API.

It also supports changing style per player with permissions (supports LuckPerms and PlayerRoles)

This mod works only on Fabric Mod Loader and compatible!

If you have any questions, you can ask them on my Discord

Also check out my other mods and project, as you might find them useful!

Example image Example image2

Commands (and permissions):

  • /global - Switch to global channel
  • /local - Switch to local channel
  • /styledchat - Main command (styledchat.main, available by default)
  • /styledchat reload - Reloads configuration and styles (requires styledchat.reload)

Configuration:

You can find config file in ./config/locale-styled-chat.json. Formatting uses Simplified Text Format. It supports usage of placeholders from Placeholder API. Additionally, every message type has few own local variables.

{
  "CONFIG_VERSION_DONT_TOUCH_THIS": 2,
  "defaultStyle": {                 // Default style settings
    "displayName": "...",           // Display name (local variables: ${vanillaDisplayName}, ${name})
    "chat": "...",                  // Chat message style (local variables: ${player}, ${message})
    "localeChat": "...",            // Locale chat message style (local variables: ${player}, ${message})
    "join": "...",                  // Join message (local variables: ${player})
    "joinRenamed": "...",           // Join message after name change (local variables: ${player}, ${old_name})
    "left": "...",                  // Player leaving server (local variables: ${player})
    "death": "...",                 // Player death message (local variables: ${player}, ${default_message})
    "advancementTask": "...",       // Finishing advancement task (local variables: ${player}, ${advancement})
    "advancementChallenge": "...",  // Finishing advancement challenge (local variables: ${player}, ${advancement})
    "advancementGoal": "...",       // Finishing advancement goal (local variables: ${player}, ${advancement}) 
    "teamChatSent": "...",          // Team message, visible to player sending it (local variables: ${team}, ${displayName}, ${message})
    "teamChatReceived": "...",      // Team message, visible to other team members (local variables: ${team}, ${displayName}, ${message})
    "privateMessageSent": "...",    // Private message, visible to player sending (local variables: ${receiver}, ${sender}, ${message})
    "privateMessageReceived": "...",// Private message, visible to others (local variables: ${receiver}, ${sender}, ${message})
    "sayCommand": "...",            // Output of /say command (local variables: ${player}, ${message})
    "meCommand": "..."              // Output of /me command (local variables: ${player}, ${message})
  },
  "permissionStyles": [             // Permission based overrides, applied from highest to lowest
    {
      "permission": "...",          // Permission string required to use
      "opLevel": 3,                 // Minimal required op level, set it to 5+ to disable it
      "style": {
        // The same values as in "defaultStyle", however it will handle missing ones just fine
        // By applying next valid 
      }
    } // You can have as many permission overrides as possible
      // Just remember to have most important ones above least (so for example Admin, Moderator, Helper)
  ],
  "petDeathMessage": "...",         // Death message send when player's pet dies (local variables: ${default_message}, ${pet})
  "emoticons": {
    "key": "output"                 // Adds emoticons/text replacements. You can use them with :key: and they are replaced with formatted output
  },
  "permissionEmoticons": [          // Permission based emoticons
    {
      "permission": "...",          // Permission string required to use
      "opLevel": 3,                 // Minimal required op level, set it to 5+ to disable it
      "emotes": {
        "key": "output"             // Same as "emoticons"
      }
    }
  ],
  "enableLocalChat": true,             // Enables local chat channel
  "localChatRadius": 100,              // Local chat radius
  "legacyChatFormatting": false,       // Enables support for legacy (&x) codes in chat (only when typed by player)
  "parseLinksInChat": true,            // Enables parsing of links in chat
  "enableMarkdown": true,              // Enables markdown
  "formattingInPrivateMessages": true, // Enables formatting in private messages
  "formattingInTeamMessages": true,    // Enables formatting in team messages
  "linkStyle": "...",                  // Style of link (local variables: ${link})
  "spoilerStyle": "...",               // Style of spoilers (local variables: ${spoiler})
  "spoilerSymbol": "▌",                // Spoiler symbol used in spoiler style
  
  "defaultEnabledFormatting": {
    "type": false
    // Here you can change which formatting is available by default for player
  }
}

In chat formatting

If player has a required permissions (styledchat.format.[tag_name], where [tagname] is Text Parser tag), then they can use Text Parser's formatting tags from within their chat. It supports all default ones with addition of <item> tag.

Example config

{
  "CONFIG_VERSION_DONT_TOUCH_THIS": 2,
  "_comment": "Before changing anything, see https://github.com/Patbox/StyledChat#configuration",
  "defaultStyle": {
    "displayName": "${vanillaDisplayName}",
    "chat": "[G] ${player} <dark_gray>»</dark_gray> <gray>${message}",
    "localChat": "[L] ${player} <dark_gray>»</dark_gray> <gray>${message}",
    "join": "<gray>✚</gray> <color:#85ff8f><lang:multiplayer.player.joined:'${player}'>",
    "joinRenamed": "<gray>✚</gray> <color:#85ff8f><lang:multiplayer.player.joined.renamed:'${player}':'${old_name}'>",
    "left": "<gray>☁</gray> <color:#ff8585><lang:multiplayer.player.left:'${player}'>",
    "death": "<gray>☠</gray> <color:#d1d1d1>${default_message}",
    "advancementTask": "<lang:chat.type.advancement.task:'${player}':'${advancement}'>",
    "advancementChallenge": "<lang:chat.type.advancement.challenge:'${player}':'${advancement}'>",
    "advancementGoal": "<lang:chat.type.advancement.goal:'${player}':'${advancement}'>",
    "teamChatSent": "<lang:'chat.type.team.sent':'<hover\\:\\'<lang\\:chat.type.team.hover>\\'><suggest_command\\:\\'/teammsg \\'>${team}':'${displayName}':'${message}'>",
    "teamChatReceived": "<lang:'chat.type.team.text':'<hover\\:\\'<lang\\:chat.type.team.hover>\\'><suggest_command\\:\\'/teammsg \\'>${team}':'${displayName}':'${message}'>",
    "privateMessageSent": "<gray>[<green>PM</green> → ${receiver}] <dark_gray>»<reset> ${message}",
    "privateMessageReceived": "<gray>[<green>PM</green> ← ${sender}] <dark_gray>»<reset> ${message}",
    "sayCommand": "<red>[${player}] ${message}",
    "meCommand": "<green>* ${player} ${message}"
  },
  "permissionStyles": [
    {
      "permission": "group.admin",
      "opLevel": 4,
      "style": {
        "displayName": "<dark_gray>[<red>Admin</red>]</dark_gray> <c:#ffe8a3>${vanillaDisplayName}</c>",
        "chat": "${player} <dark_gray>»</dark_gray> <orange>${message}",
        "death": ""
      }
    },
    {
      "permission": "group.default",
      "opLevel": 0,
      "style": {
        "displayName": "<dark_gray>[<aqua>Player</aqua>]</dark_gray> <dark_aqua>${vanillaDisplayName}</dark_aqua>"
      }
    }
  ],
  "petDeathMessage": "Oh no! ${default_message}",
  "emoticons": {
    "bucket": "🪣",
    "sword": "🗡",
    "potion": "🧪",
    "trident": "🔱",
    "shears": "",
    "rod": "🎣",
    "fire": "🔥",
    "shrug": "¯\\_(ツ)_/¯",
    "bow": "🏹",
    "bell": "<yellow>🔔",
    "table": "<rb>(╯°□°)╯︵ ┻━┻",
    "heart": "<red>❤"
  },
  "permissionEmoticons": [
    {
      "permission": "group.vip",
      "opLevel": 3,
      "emotes": {}
    }
  ],
  "enableLocalChat": true,
  "localChatRadius": 100,
  "legacyChatFormatting": true,
  "parseLinksInChat": true,
  "enableMarkdown": true,
  "formattingInPrivateMessages": true,
  "formattingInTeamMessages": true,
  "linkStyle": "<underline><blue>${link}",
  "spoilerStyle": "<dark_gray>${spoiler}",
  "spoilerSymbol": "",
  "defaultEnabledFormatting": {
    "dark_red": false,
    "color": false,
    "underline": true,
    "yellow": false,
    "italic": true,
    "dark_blue": false,
    "dark_purple": false,
    "gold": false,
    "red": false,
    "aqua": false,
    "hover": false,
    "gray": false,
    "light_purple": false,
    "white": false,
    "pos": true,
    "dark_gray": false,
    "spoiler": true,
    "strikethrough": true,
    "lang": false,
    "obfuscated": false,
    "dark_grey": false,
    "key": false,
    "change_page": false,
    "st": true,
    "b": true,
    "item": true,
    "green": false,
    "c": false,
    "dark_green": false,
    "gradient": false,
    "black": false,
    "em": false,
    "i": true,
    "bold": true,
    "gr": false,
    "grey": false,
    "orange": false,
    "rb": false,
    "rainbow": false,
    "obf": false,
    "colour": false,
    "blue": false,
    "dark_aqua": false,
    "underlined": false,
    "reset": false,
    "page": false,
    "font": false
  }
}

About

Style your chat as you want! (Server side, Fabric)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%