-
Notifications
You must be signed in to change notification settings - Fork 8
Formats
ChatControl enables you to take full control on how the message looks like. The file formatting.yml enables you to make as many formats as you like, so you can use them anywhere in our plugin anyhow you desire.
Formats can be applied to all chat types (normal, ranged, bungee, ...), chat channels or even private messages and more.
The Formats section consists of two important elements.
The format name is totally up to you and you will call it from other places in ChatControl to use your format.
Each format is built of parts. Which part represents a portion of the message that is formatted. Parts exist because you can assign different interactive elements for each one.
In each part, you can use all variables listed here.
Let's take a look at the following example. It consists of two parts that are joined together when a chat message is sent. Read the image comments for a better understanding of how things work.
Now we need to make this format work. To do so, we set "Formatting.Default" to "Chat" in our file so ChatControl starts to use that format for our default chat. When you use Chat Channels, you need to give the format name in channels.yml file instead.
When we jump into the game, this is what happens when we type a message:
Since we also installed hover and click events on the first part of our format (the one showing player prefix and their name), they start functioning immediately when our mouse is moved onto that part. Also, upon clicking the part, a new suggested message is put into our chat console. That's how powerful ChatControl is.
You can write multiple options to each part enhance its functionality up to your requirements. Simply write the setting key and a value from the list below and effect will take place upon when you reload the plugin (/chc reload).
Info: What message shall be printed out to the chat?
Accepts: String
Message: '{pl_prefix}{player}{pl_suffix}&7: {message}'
Info: Makes the entire part only show if the sender of the message has the specified permission.
Accepts: String
Sender_Permission: 'my.custom.permission'
Info: Makes the entire part only show if a specific Javascript condition is met. Variables, including those from PlaceholderAPI are supported. See here for more information.
Condition: '"{player}" == "kangarko"'
Info: What happens when a mouse cursor goes over to this part?
Accepts: see below
The action represents what can happen. Possible values: SHOW_TEXT, SHOW_ACHIEVEMENT, SHOW_ENTITY and SHOW_ITEM.
Messages, per line, to display.
Hover_Event:
Action: SHOW_TEXT
Values:
- "&6This player is VIP"
- "&6Check out &e/web &6to obtain VIP"
Info: What happens when a mouse cursor clicks on this part?
Accepts: see below
The action represents what can happen. Possible values: OPEN_URL, OPEN_FILE, RUN_COMMAND and SUGGEST_COMMAND.
Messages, per line, to display.
Click_Event:
Action: SUGGEST_COMMAND
Value: "/tell {player} "
© MineAcademy | Code Unique Minecraft Plugins & Servers In 20 Days
About
Free version
Basics
Understanding
- Channels
- Formatting
- Rules / Filters
- Handlers
- Groups
- JSON
- Discord
- Toggle ignoring swears
- Variables
- JavaScript Variables
Tweaking
Solving Issues
Miscellaneous