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

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. a

Introduction to Formats

The Formats section consists of two important elements.

1) Format names

The format name is totally up to you and you will call it from other places in ChatControl to use your format.

2) Format parts

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.

Creating Our First Format

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.

a

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:

b

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.

c

Part Options

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).

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