Code Monkey home page Code Monkey logo

styledchat's Introduction

Logo

Styled Chat

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):

  • /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/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})
    "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"
      }
    }
  ],
  "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": "${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": {}
    }
  ],
  "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
  }
}

styledchat's People

Contributors

patbox avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.