Skip to content

Activators

Menu author

Activator is an events that causes menu opening.

All activators must be inside the activators block in menu root along with parameters such a title and size. You can specify one or several activators, or you can make menu without activators. Example:

activators {
command: [ // Open menu by one of the command in list
"menu",
"game"
]
join: true // Also open menu on joining to server
}

In this example, the menu will be opened when you joined to the server, or if you enter /menu or /game command.

NameData typeDescription
commandMultiple typesOpen menu when command entered
chatStrings listOpen menu when entered some chat message
containsChatStrings listOpen menu when chat message contains some word
joinBooleanOpen when player joins the server
regionJoinStrings listOpen menu when player joined some WG region
regionLeaveStrings listOpen menu when player leaved some WG region
clickItemObjects listOpen menu when RMB click on the item in the hand
clickNPCNumbers listOpen menu when RMB click on NPC (from Citizens)
clickEntityObjects listOpen menu when RMB click on entity
shiftClickEntityObjects listOpen menu when Shift-RMB click on entity
clickBlockObjects listOpen menu when some block in specified location clicked
clickBlockTypeStrings listOpen menu when some block of specified type clicked
buttonObjects listOpen menu when button clicked
leverObjects listOpen menu when lever shifted
plateObjects listOpen menu when plate activated
tableStrings listOpen menu when sign with some text clicked
swapItemsNoneOpen menu when player swaps item. By default it’s ‘F’ key

Under each activator below you’ll see an Extractor type line. That’s the name of the %activator_<key>% placeholder set you can use in the opened menu to read data about whatever triggered the activator: the item in hand, the region, the NPC, the block, the command arguments.

Usage: drop %activator_<key>% into the menu title, item name/lore, rule conditions, action arguments. Find the available keys for each extractor in Value extractors. The Extractor type label is a link to that extractor’s table.

Example. clickItem uses extractor-item. A player right-clicks a DIAMOND named “Excalibur”:

title: "Clicked on %activator_item_type% (%activator_item_display_name%)"

Menu opens with the title Clicked on DIAMOND (Excalibur).

%activator_name% is always available too - it returns the activator’s own name (clickItem, command, regionJoin…).

Some activators show *None* here, which means they don’t carry their own context, so %activator_<key>% placeholders don’t apply (only %activator_name% does).

Extractor type: extractor-cmd

Open menu if player entered command. This activator has several formats which described below.

Just single command name without arguments. Example:

command: "menu"

You can add aliases to your command. For this, you need to write command activator as list of strings. Example:

command: [
"menu",
"game"
]

When you enter /menu or /game command, menu will be opened.

This activator has other, more complex formats — you can build your own commands with arguments. See activator input.

Extractor type: None

This is a list in which a word or words are specified, when you enter one of them in the chat, menu will be opened. Example:

chat: [ // Ope menu when entered to chat one of the messages
"hello",
"open the menu"
]

This is a list in which you can specify words, phrases, etc. Menu will be opened if entered message contains at least one specified word, phrase or symbol. Example:

containsChat: [
"hey",
"menu",
"or"
]

In this example, if player’s message contains hey, menu or or symbols together, then menu will be opened.

Extractor type: extractor-region

These activators require the WorldGuard plugin and useWorldGuard: true in config.conf.

Here listed regions which will open the menu when entering into them. Example:

regionJoin: [ // Open a menu when enter region
"spawn",
"otherRegion"
]

In this example, the menu will be opened if you enter to spawn or otherRegion region.

Here listed regions which will open the menu when leaving a region. Example:

regionLeave: [ // Open menu when leaving from region
"pvp",
"someRegion"
]

In this example, the menu will be opened if you leave from spawn or otherRegion region.

Extractor type: extractor-item

You can add activator to open menu when some item clicked by right click in player’s hand.

clickItem {
material: STONE
name: "Open menu"
}

Extractor type: extractor-npc

Here listed NPC id which will open the menu when click NPC. Example:

clickNPC: [
1,
23
]

In this example, the menu will be opened if you clicked on the NPC with id 1 or 23.

Open menu by clicking on entity. There are two types of this activator: for simple clicks and clicks with Shift key pressed.

Extractor type: extractor-entity

The clickEntity activator is a list of objects. Each object is a simple entity data. Example:

clickEntity {
type: ZOMBIE
name: "&eZombie"
}

If you want to add multiple entities, you can use this activator as list. Example:

clickEntity: [
{
type: ZOMBIE
name: "&eZombie"
},
{
type: PLAYER
}
]

Each object have parameters:

In this example we specified PLAYER entity and ZOMBIE entity with &eZombie name. If player clicked on any player or zombie named &eZombie, menu will be opened.

Extractor type: extractor-entity

Same shape as clickEntity above. The only difference: this one fires only when the player is sneaking (Shift held) at the moment of the click. Example:

shiftClickEntity {
type: PLAYER
}

If you want to add multiple entities, you can use this activator as list. Example:

shiftClickEntity: [
{
type: ZOMBIE
name: "&eZombie"
},
{
type: PLAYER
}
]

Block click activators handles clocking on block (right and left click). THere are two types of this activator, to check click by block location, or block type (material).

Extractor type: extractor-block

In this code block you can specify location of some world’s block. If player click on this block, menu will be opened.

clickBlock {
world: "world"
x: 0.0
y: 0.0
z: 0.0
yaw: 0.0
pitch: 0.0
}

And short version:

clickBlock: "world, 0.0, 0.0, 0.0, 0.0, 0.0"

This version has format:

clickBlock: "<world>, <x>, <y>, <z>, <yaw>, <pitch>"

There is ability to specify several locations, since clickBlock is a list.

clickBlock: [
"world, 0, 0, 0",
"world, 1, 1, 1",
]

Extractor type: extractor-block

In this code block you can specify type of some world’s block. If player click on block of specified type, menu will be opened. Example:

clickBlockType: STONE

If you want to add multiple block types, you can use this activator as list:

clickBlockType: [
STONE,
CAKE
]

Extractor type: extractor-block

A button, lever and plate activators has same format. Below is example for buttons:

button {
world: "world"
x: 0.0
y: 0.0
z: 0.0
}

The location, as in other places, can be specified in one line:

button: "<x>, <y>, <z>" - The world will default (world). Yaw and Pitch are zero.

button: "world, <x>, <y>, <z>" - Yaw and Pitch are zero.

button: "world, <x>, <y>, <z>, <yaw>, <pitch>" - Includes all location parameters.

There is ability to specify several locations, since button, lever and plate is a lists.

plate: [
"world, 0, 0, 0",
"world, 3, 1, 8",
]

Extractor type: None

The table activator is a strings list

table: [
"[OPEN]"
]

In this example, the label in the first line should be the text [OPEN].

table: [
"[OPEN]"
""
"menu"
]

In this example, the label in the first line should be the text [OPEN], and on the third a menu.

Extractor type: None

This activator opens menu if player press key to swap items. By default this key is F. Since this activator has no any arguments, we will use just true value. Example:

activators {
swapItems: true
}