Actions v2 - RealMegaMinds/ActionInventoryMod GitHub Wiki

Actions


Actions determine what actually happens when an action item is clicked.

Actions are represented by a json object. All actions have:

Type

key = 'type'
Can be one of 'command', 'give', 'open', 'sound', 'allmessage', 'multimessage', 'playermessage', 'servermessage', and 'singlemessage'.

Type Specific

Depending on the type, there are additional requirements. Note: references to "player" means the player that clicked the action item.

Command

This executes a command.
An action with type 'command' must have:

Command

key = 'command'
This is a string. This is the command to execute.

From Server

key = 'fromServer'
This is a boolean. This determines whether the command is executed by the server (true) or by the player (false).

Make Temp OP

key = 'makeTempOp'
This is a boolean. This determines whether the player should be temporarily given op to execute the command (true) or if the command should throw an error if the player is not an op and the command requires it (false). If true, when the command is finished the player will be deopped (if they weren't previously opped).

Give

This gives the player items.
An action with type 'give' must have:

Item Stack

key = 'itemStack'
This is an object. This is the item stack to give the player. Contains:

Item

key = 'item'
This is a string. This is the identifier of this item stack's item.

Count

key = 'count'
This is an int. This is the number of items this item stack has.

NBT

key = 'nbt'
This is a string. This is the item stack's custom nbt in snbt format.

Open

This opens an action inventory for the player.
An action with type 'open' must have:

Name

key = 'name'
This is a string. This is the name of the action inventory to open.

Sound

This makes a sound when clicked.
An action with type 'sound' must have:

Sound

key = 'sound'
This is a string. This is the identifier for the sound to play.

Pitch

key = 'pitch'
This is a float. This is the pitch of the sound.

Volume

key = 'volume'
This is a float. This is the volume of the sound.

All Message

This broadcasts a message to all players.
An action with type 'allMessage' must have:

Message

key = 'msg'
This is an object. This is the message to send.

From Server

key = 'fromServer'
This is a boolean. This determines whether the message should be sent from the server (true) or from the player (false).

Multi Message

This sends a message to multiple players.
An action with type 'multiMessage' must have:

Message

key = 'msg'
This is an object. This is the message to send.

From Server

key = 'fromServer'
This is a boolean. This determines whether the message should be sent from the server (true) or from the player (false).

To

key = 'to'
This is an array of strings. These are the uuids of the players to send the message to.

Single Message

This sends a message to a single player.
An action with type 'singleMessage' must have:

Message

key = 'msg'
This is an object. This is the message to send.

From Server

key = 'fromServer'
This is a boolean. This determines whether the message should be sent from the server (true) or from the player (false).

To

key = 'to'
This is a string. This is the uuid of the player to send the message to.

Player Message

This sends a message to the player that clicked the action item.
An action with type 'playerMessage' must have:

Message

key = 'msg'
This is an object. This is the message to send.

From Server

key = 'fromServer'
This is a boolean. This determines whether the message should be sent from the server (true) or from the nil_uuid (false).

Server Message

This sends a message to the server/logs a message.
An action with type 'serverMessage' must have:

Message

key = 'msg'
This is an object. This is the message to send.

From Player

key = 'fromPlayer'
This is a boolean. This determines whether the message should be sent from the player (true) or from the nil_uuid (false).

⚠️ **GitHub.com Fallback** ⚠️