Skip to content

Configuration Files

Lilac edited this page May 14, 2023 · 26 revisions

Introduction

RoseChat has several different configuration files that can be used to edit many different aspects of the plugin. Each config file has comments explaining the settings, but further information will be explained below.

config.yml

The config file is used to edit most settings in the plugin. Please read the comments explaining each setting to understand what it does. One section that is particularly useful is the chat-formats section:

chat-formats:

  # The format of a /message sent to another player.
  # Default: {message-sent}{message}
  message-sent: '{message-sent}{message}'

  # The format of a /message received from another player.
  # Default: {message-received}{message}
  message-received: '{message-received}{message}'

  # The format of a spied /message.
  # Default: {spy-prefix}{spy-players}{message}
  message-spy: '{spy-prefix}{spy-players}{message}'

  # The format of a group message.
  # Default: {group-prefix}{group-member-prefix}{player}{separator}{message}
  group: '{group-prefix}{group-member-prefix}{player}{separator}{message}'

These are used by RoseChat to decide the format of the message that should be sent to the players. Each item surrounded by {} are placeholders that are defined in custom-placeholders.yml. These can be chained together to create a format perfect for you.

channels.yml

The channels file is used to define your own custom chat channels that can be used in-game. There are a few default channels to display how they work.

Channel Options

Option Description Example
default This sets the channel as the default channel.
Players will be placed into this channel when they first join the server.
There can only be one default channel.
default: true
format The format of the channel.
The format is the same as formats in config.yml, and uses placeholders defined in the custom-placeholders.yml file.
format: '{prefix}{player}{separator}{message}'
commands This creates command aliases for the channel. Players can then use that command to join the channel. commands:
- staff
radius The radius defines the distance that chat messages can be read from. If two players are over radius blocks away from each other, they will not be able to read the others' message. radius: 200
worlds The worlds that the player has to be in to send and receive messages. worlds:
- skyblock
auto-join If this is enabled, and combined with a world setting, when a player enters the world they will also join the channel. auto-join: true
visible-anywhere If this is enabled, players in this channel will be able to see the messages while they're using another channel. visible-anywhere: true
joinable If this is enabled, the channel can be joined with a command. Disable this to stop players using a command to join.
This can be combined with visible-anywhere and world to only allow players to talk in the channel with a command, or when in a specific world.
This is enabled by default.
joinable: false
discord The DiscordSRV channel that messages can be sent and received from.
This needs to match a channel defined in DiscordSRV's config file.
Requires DiscordSRV installed.
discord: global
servers This allows messages to be sent to the listed servers.
This needs to match a server defined in bungeecord.yml.
Requires BungeeCord.
servers:
- skyblock
keep-format-over-bungee This allows this channel's format to be sent over bungee servers. This is very useful when you have placeholders for a specific player on one server, and need them on the second server.
Requires BungeeCord.
keep-format-over-bungee: true
override-commands This allows another plugin's commands to be overriden, so chat messages can be sent via RoseChat instead. For example, overriding the command island chat will allow players to use /island chat to talk in this channel. override-commands:
- 'island chat'
shout-commands This allows a player to use a prefix in their message to send that message to another channel. For example, !hello could send hello to the global channel. shout-commands:
- !

Other options in channels.yml are related to specific plugins, these can be viewed here.

emojis.yml

The emojis file is used to define custom emojis. With a Resource Pack these can include custom images. This file is different to replacements.yml as it has a font option, which allows resource packs to handle what the emojis look like.

Emoji Options

Option Description Example
text This is the text that the player will type before being replaced with an emoji. This can be anything. text: :rosewood:
replacement This is what the text will be replaced with. This can be anything.
When using a resource pack, this should be a unicode number.
replacement: "🌹"
hover This is what will be shown when the player hovers over the emoji. This can be anything.
This is optional.
hover: &b&o:rosewood:
font This is the font that will be used for the emoji. You can ignore this if not using a resource pack. This is optional, all emojis will use the "default" font unless specified otherwise. font: emoji

replacements.yml

The replacements file is used for replacing messages with other content. This can be used for fun, or to filter a message. For example, the default file replaces <3 with ❤️. These are similar to emojis, but do not have a font option. They have a regex option which can be used to match replacements easier.

Replacement Options

Option Description Example
text This is the text that the player will type before being replaced with an emoji. This can be anything.
If regex is true, this should be the regex to match with.
text: :rosewood:
replacement This is what the text will be replaced with. This can be anything. replacement: "{url}"
regex This should be enabled if you want the replacement to match with regex.
This is optional.
regex: true

tags.yml

The tags file can be used to create tags; these can tag specific players or add extra detail to messages.

Tag Options

Option Description Example
prefix The prefix used to start the tag.
This means that the player will need to use this to start the tag, for example, in the player tag, @Player is used to tag players. @ is the prefix.
This is required.
prefix: '@'
suffix This suffix is used to end the tag. This means that the player will need to use this to end the tag. For example, in the spoiler tag, <spoiler>message</spoiler>, </spoiler> is the suffix. suffix: </spoiler>
tag-online-players If enabled, this will allow the tag to target players and replace names with nicknames. tag-online-players: true
match-length If enabled, this allows the replacement to be the same length as the message sent.
This is useful as it can replace a 3 letter long word with 3 of the same character.
match-length: true
sound The sound that will be sent to the player who receives the tag.
tag-online-players must be enabled.
Valid sounds can be viewed here.
sound: BLOCK_NOTE_BLOCK_PLING
format This is used the same as formats described earlier. The tag is replaced with this format.
This is required.
format: {player-tag}

custom-placeholders.yml

The placeholders file is used to define placeholders that RoseChat uses. This is probably the most useful file. It allows you to define different hover and click events based on different conditions. These can then be put together in a format to display that content to the players. The {message} placeholder is reserved for displaying messages, creating a placeholder called message will not do anything.

Creating a Placeholder

A placeholder must first start with an ID, called player in this instance. This can be anything.

player:
  text:
    default: "%player_nickname%"
  hover:
    default:
      - "&7Username: &f%player_name%"
      - "&7Click to Message"
  click:
    default:
      action: SUGGEST_COMMAND
      value: "/msg %player_name% "

The text section tells the placeholder that text must be shown. This is required.
default is required if no condition (explained below) is defined.
The hover section tells the placeholder that a hover event should be shown. This is when a player hovers over the message. As hover events can have multiple lines, this is a list. This section is optional.
The click section tells the placeholder that a click event should be shown. This is when a player clicks the message. Click events have actions that define what they do, and values which define what the content of the action is. In this example, the value will be shown in the player's text box when they click the message.

Conditional Placeholders

Placeholders can also have conditions. These bring futher customizability to them. Conditions are exactly what they sound like, a condition must be hit for a placeholder to be shown. However, in RoseChat you can also show something if a condition is not met.

prefix:
  text:
    condition: "%vault_rank%"
    default: "&7"
    admin: "&8[#C0FFEEAdmin&8] #C0FFEE"
  hover:
    condition: "%vault_rank%"
    admin:
      - "&cThis player administrates the server!"

This works similarly to the previous example, but using conditions to drive what is shown. In this instance the placeholder %vault_rank% is the condition. If the rank is admin, then the admin prefix will be shown and when hovered, the admin hover event will be shown. This works the same for click events.

Conditions

Conditions can work in a variety of ways. These are an example of how conditions are formatted in RoseChat.
Conditions can have operations in them, for example:

Condition Definition Example Meaning
= Is equal to %group_owner%=%player_name% If the group owner is the same as the player viewing the message, this will be true
!= Is not equal to %group_owner%!=%player_name% If the group owner is not the same as the player viewing the message, this will be true
^ Contains %vault_rank%^staff If the rank includes "staff", this will be true.

Strings

If a condition returns a word (not a number or true/false value), this format can be used:

  text:
    condition: "%vault_rank%"
    default: "&7"
    vip: "&a"
    vip+: "&2"
    helper: "&9"

If the condition returns one of the values below it, that value will be used. If not, default will be used.

Numbers

If a condition returns a number, this format can be used:

  text:
    condition: "%playerpoints_points%"
    value: 500
    more: "&eYou're rich!"
    equal: "&fYou've got exactly 500 points!"
    less: "&7You should earn more points..."

If the condition (the amount of points that the player has) is more than the value, then more will be used. If the condition is the same as the value, then equal will be used. If the condition is less than the value, then less will be used. You do not need more, equal and less if you do not plan on using them, having a default value can work if you only need one.

Booleans (True/False)

If a condition returns true or false (or yes or no in PlaceholderAPI), this format can be used:

  text:
    condition: "%group_owner%=%player_name%"
    default: ""
    true: "&e:star:"
    false: ""

If the condition is true, the true value will be used. If the condition is false, the false value can be used. If, for any reason, the placeholder cannot be parsed, then default will be used. It may be easier to only include default and true if both default and false are the same.

Boolean conditions can also be OR'd. This means, you can check if one condition OR another condition is true, for example:

  text:
    condition: "%player_ping%<20||%playerpoints_points%>500"
    true: "&bCool "

In this condition, if the player has less than 20 ping or they have more than 500 points, then the prefix &bCool is applied.

Multiple Conditions

If you want to use multiple conditions at once, a comma can be used like this:

  text:
    condition: "%vault_rank%,%player_biome%"
    default,default: "&7Default "
    default,beach: "&6Sandy "
    admin,beach: "&6Sandy &cAdmin "
    

If the player is default, or has a rank not listed, then the first condition will return default. After this, the second condition is checked, if they are in a biome that is not listed, the second condition will also return default, causing the prefix to be &7Default . However, if the player is in a beach, then the prefix will be &6Sandy . If the player is an admin, and in a beach, their prefix will be &6Sandy &cAdmin .

Multiple conditions can also work with boolean conditions, for example:

  text:
    condition: "%vault_rank%,%playerpoints_points>500"
    admin,true: "&aA Rich Admin "

Discord Embeds

When using DiscordSRV, an embed can be used to display messages. By default, just a simple message is used. In order to use embeds, these options are used in the placeholder:

discord:
  # The URL that is used for the title of the embed, this can be clicked on.
  url:
    default: "https://www.example.com"
  # The title of the embed. In this instance, the player's name.
  title: 
    default: "%player_displayname%"
  # The description of the embed. This is used to display the message.
  description:
    default:  "{message}"
  # Whether or not a timestamp should be shown.
  timestamp:
    default: true
  # The colour of the embed, this needs to be an integer and not a hex colour.
  color: 
    default: 12648430
  # The image displayed along with the embed, this link gets the player's head.
  thumbnail:
    default: "https://cravatar.eu/helmavatar/%player_name%/32.png"
  # The size of the thumbnail.
  thumbnail-width:
    default: 32
  thumbnail-height:
    default: 32

These are all the options used for a discord embed. One setting, either title or description must include the {message} placeholder, so that the message can be shown. These options create this:
image

Default Placeholders

RoseChat has some placeholders that do not require PlaceholderAPI.

Placeholder Definition
%player_name% The name of the player who sent the message.
%player_displayname% The display name of the player who sent the message.
%player_nickname% The nickname (from using /nick) of the player who sent the message.
If a player does not have a nickname, then the display name will be used.
If the player does not have a display name, then the name will be used.
%group% If sent in a group, the ID of the group a message is sent in.
%group_name% If sent in a group, the name of the group a message is sent in.
%group_owner% If sent in a group, the name of the owner of a group a message is sent in.
%channel% If sent in a channel, the name of the channel a message is sent in.

Placeholders can also be prefixed with "other_" to get the person viewing the message, rather than the sender. For example, %other_player_name% gets the name of the viewer.