Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Formats

kangarko edited this page Apr 5, 2019 · 21 revisions

Chat formats give your chat messages a proper look. They are found in the formatting.yml file, saving space so you can use the same format multiple times in the plugin.

ChatControl enables you to take full control on how the message looks like. We can transform a basic chat message like this. b

Into having interactive elements such as hover or click effects, and more. a

Structure

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.

Using JSON and Making Own Formats

From a great explanation, see https://github.com/kangarko/ChatControl-Pro/issues/771

Variables

In each part, you can use all variables listed here.

Part Options

There are many settings that can be given to a format's part, see below:

Message

Info: What message shall be printed out to the chat?

Accepts: String

Message: '{pl_prefix}{player}{pl_suffix}&7: {message}'

Sender_Permission

Info: Makes the entire part only show if the sender of the message has the specified permission.

Accepts: String

Sender_Permission: 'my.custom.permission'

Condition

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"'

Hover_Event

Info: What happens when a mouse cursor goes over to this part?

Accepts: see below

Action

The action represents what can happen. Possible values: SHOW_TEXT, SHOW_ACHIEVEMENT and SHOW_ITEM.

Values

Messages, per line, to display.

Hover_Event: 
  Action: SHOW_TEXT
  Values: 
    - "&6This player is VIP"
    - "&6Check out &e/web &6to obtain VIP"

Click_Event

Info: What happens when a mouse cursor clicks on this part?

Accepts: see below

Action

The action represents what can happen. Possible values: OPEN_URL, OPEN_FILE, RUN_COMMAND and SUGGEST_COMMAND.

Values

Messages, per line, to display.

Click_Event: 
  Action: SUGGEST_COMMAND
  Value: "/tell {player} "

Example Format

Below is an example of an entire format named "Chat" with parts: "Vip", "Prefix", "Player", "Suffix" and "Message".

Chat: 
    #
    # This is a part. That means, we split the message into as many parts
    # as you'd like, giving each part different interactive properties.
    #
    # Options such as Sender_Permission or Hover_Event are not obligatory, you can remove
    # them or add them at your will. For tutorial and all available options, see the link above.
    #
    Vip: 
      Message: "&6[VIP] "
      Sender_Permission: "chatcontrol.groups.vip"
      Hover_Event: 
        Action: SHOW_TEXT
        Values: 
          - "&6This player is VIP"
          - "&6Check out &e/web &6to obtain VIP"
    Prefix: 
      Message: "&f{pl_prefix}"       
      Hover_Event: 
        Action: SHOW_TEXT
        Values: 
          - "&8*-----* &f{player} &8*-----*"
          - "&7Prefix&8: &7{pl_prefix}"
          - "&7Group&8: &b{pl_group}"
    Player: 
      Message: "{player}:"                 
      Hover_Event: 
        Action: SHOW_TEXT
        Values: 
          - "&7Message issued: &b{timestamp}"
          - "&7Click to send a PM"
      Click_Event: 
        Action: SUGGEST_COMMAND
        Value: "/tell {player} "            
    The_Rest: 
      Message: "{pl_suffix} {message}"