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 Aug 31, 2017 · 21 revisions

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

Structure of a Format

Each format is built of unlimited amount of parts. Which part represents a chunk of the message that is formatted, with the possibility of having different interactive elements on each part.

Variables in a Format

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

Example Format

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

Chat:
  Vip: 
    Message: "&6[VIP] "       
    Permission: "chatcontrol.groups.vip"
    Hover_Event: 
      Action: SHOW_TEXT
      Values: 
        - "&6This player is VIP"
        - "&6Check out &e/web &6to obtain VIP"
      
  Prefix: 
    Message: "{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} "
            
  Suffix: 
    Message: "{pl_suffix} "
        
  Message: 
    Message: "{message}"

Options for a Part

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'

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