Skip to content

Default replacements.yml

Lilac edited this page Jul 31, 2024 · 4 revisions
# This file allows you to replace parts of a player's message.
# These can be used for emojis, custom color codes, general replacements or regular expressions.
# These replacements can be used with custom placeholders from custom-placeholders.yml
# Check the wiki for more information: https://github.com/Rosewood-Development/RoseChat/wiki/Configuration-Files#replacementsyml

# This emoji is used in group chats by default.
star:
  # The text that the player will type.
  input:
    text: ':star:'
    can-toggle: true
  # The replacement, ":star:" will turn into "✸" when sent.
  output:
    text: ''

# A custom resource pack would need to be used for users to see this emoji.
rosewood:
  input:
    text: ':rosewood:'
    can-toggle: true
  output:
    text: "\uE000"
    # When the replacement is hovered over, this text will be shown.
    hover: '&b&o:rosewood:'

heart:
  input:
    text: '<3'
    can-toggle: true
  output:
    text: "\u2764"

rainbow:
  input:
    text: '&h'
  output:
    text: '<r:0.5>'
    # This option allows a colour to be passed to the following text.
    color-retention: true

# This replacement uses a {custom placeholder} to add extra information.
item:
  input:
    text: '[item]'
  output:
    text: '{item}'

# This uses a regex to replace a URL with a {custom placeholder}.
regex-example-url:
  input:
    text: '(?:http(?:s){0,1}://){0,1}[-a-zA-Z0-9@:%._\+~#=]{2,32}\.[a-zA-Z0-9()]{2,16}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)'
    is-regex: true
  output:
    text: '{url}'

spoiler:
  input:
    # A prefix and suffix tell the plugin that the text between them should be replaced.
    # For example, <spoiler>Test</spoiler> will become ⬛⬛⬛⬛.
    prefix: '<spoiler>'
    suffix: '</spoiler>'
  output:
    # A {custom placeholder} is used here to add information to the hover.
    text: '{spoiler-tag}'
    # This setting changes the length of the replacement to be the same as what is inside the spoiler tags.
    # A four-letter word will become ⬛⬛⬛⬛.
    match-length: true

money:
  input:
    text: '\$([0-9]*)'
    is-regex: true
  output:
    # This replaces the text with the first group found in the regex.
    text: '{money}'

player:
  input:
    # Using only a prefix looks for text after the prefix, until the stop is found.
    prefix: '@'
    stop: '[\p{P}\p{S}]'
  output:
    text: '{player-tag}'
    # If a player is found within the text, it will change the text to their display name.
    tag-online-players: true
    sound: BLOCK_NOTE_BLOCK_PLING

# This is an inline replacement.
# This allows for grabbing two different parts of text without using regex.
# This example replaces "[www.example.com](Click Here!)" with "Click Here!" with a hover of "www.example.com".
url:
  input:
    prefix: '['
    suffix: ']'
    text: '(?:http(?:s){0,1}://){0,1}[-a-zA-Z0-9@:%._\+~#=]{2,32}\.[a-zA-Z0-9()]{2,16}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&//=]*)'
    inline-prefix: '('
    inline-suffix: ')'
    # This allows the 'text' value to be used a regex matcher for the text between ( and ).
    is-inline-regex: true
  output:
    text: '{url}'

hover-tag:
  input:
    text: "<hover:(.*)>(.*)</hover>"
    is-regex: true
  output:
    text: '{hover-tag}'

hover:
  input:
    text: "<hover:(.*)>(.*)"
    is-regex: true
  output:
    text: '{hover-tag}'