-
Notifications
You must be signed in to change notification settings - Fork 8
Formats
For ChatControl since version 9.0.0 you should use new wiki which you can find here: https://support.mineacademy.org/wiki/display/CHC/
dadsada
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.
Some people prefer to use ChatControl instead of any prefix-management or permission plugin to print different chat messages for different ranks. Here's an example. Please also see the Parts Option section below for an explanation on the different keys.
To use this, place this in the Formats section in your formatting.yml and then refer to it from elsewhere by calling Ranked_Format name, such as in Formatting.Default key above in the same file.
# This format is called "Ranked_Format" and will show different
# parts before the player's prefix and name depending on what
# permission the player (the sender) has.
Ranked_Format:
Rank_1:
Message: "&c[Admin] "
Sender_Permission: "my.rank.admin"
Rank_2:
Message: "&9[Mod] "
Sender_Permission: "my.rank.mod"
Rank_3:
Message: "&6[Helper] "
Sender_Permission: "my.rank.helper"
The_Rest:
Message: "&7{pl_prefix+}{player}&7: &f{message}"
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