Denizen Script Meta Documentation Search


Learn about how Denizen works in The Beginner's Guide.
Showing 46 search results for click out of 3884 meta-documentation entries...

Perfect Name Match Results



Action


Action Linesclick
Triggerswhen the NPC is clicked by a player.
ContextsNone
Determine"cancelled" to cancel the click event completely.
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/ClickTrigger.java#L68

Partial Name Match Results


Action Linesno click trigger
Triggerswhen the NPC is clicked but no click trigger fires.
ContextsNone
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/ClickTrigger.java#L57

Command


NameClickable
Syntaxclickable (<script>/cancel:<id>) (def:<element>|.../defmap:<map>/def.<name>:<value>) (usages:<#>) (for:<player>|...) (until:<duration>)
Short DescriptionGenerates a clickable command for players.
Full DescriptionGenerates a clickable command for players.

Generally, prefer to write a command script and simply "on_click[/yourcommandhere]" rather than using generated clickables.
Generated clickables are a utility intended to enable clickables that are restricted from being normally accessed without receiving a clickable message.

Specify a task script to run, or put an executable script section as sub-commands.

When running a task, optionally any definitions to pass.

When using a sub-section, the running commands will be in their own queue, but copy out the original queue's definitions and context source.

Optionally specify a maximum number of usages (defaults to unlimited).

Optionally specify a maximum duration it can be used for with 'until'.

If no duration is specified, the clickable will remain valid until the server stops or restarts.
WARNING: if you use clickables very often without a duration limit, this can lead to a memory leak.
Clickables that have a specified max duration will occasionally be cleaned from memory.

Optionally specify what players are allowed to use it. Defaults to unrestricted (any player that sees the click message may use it).
Note that it is possible for a player to find the generated command ID in their logs and send it to another player to "/" execute, so if you don't restrict player access it may be abused in that way.

This internally generates a command of the form "/denizenclickable <generated_id>".

Players will need the permission "denizen.clickable" to be able to use this.

You can cancel a clickable at any time via "cancel:<id>", where ID is the generated ID from saving the initial generated command.
Related Tags<entry[saveName].command> returns the command to use in "on_click".
<entry[saveName].id> returns the generate command's ID.
<ElementTag.on_click[<command>]> Adds a click command to the element, which makes the element execute the input command when clicked. (...)
Usage Example
# Use to generate a clickable that just narrates "hello there!" when clicked.
- clickable save:my_clickable:
    - narrate "Hello there!"
- narrate "Click <blue><element[here].on_click[<entry[my_clickable].command>]><reset>!"
Usage Example
# Use to generate a clickable message that will run a task script named 'test_script'.
- clickable test_script save:my_clickable
- narrate "Click <blue><element[here].on_click[<entry[my_clickable].command>]><reset>!"
Usage Example
# Use to generate a clickable message that will run a task script named 'reward_drop', that can be used by only the first person to click it.
- clickable reward_drop usages:1 save:reward
- announce "<blue><bold><element[Reward Here].on_click[<entry[reward].command>]><reset>!"
Usage Example
# Use to generate a clickable message exclusively for the linked player, that must be used within a minute.
- clickable your_secret def:quest3 for:<player> until:1m save:secretmessage
- narrate "Do you want to know the secret? <blue><element[Yes].on_click[<entry[secretmessage].command>]><reset> / No."
Usage Example
# Use to generate a clickable message and cancel it manually later.
- clickable test_script save:my_clickable save:myclickable
- narrate "Click <blue><element[here].on_click[<entry[my_clickable].command>]><reset> before you land!"
- waituntil rate:1s max:30s <player.is_on_ground>
- clickable cancel:<entry[myclickable].id>
Groupplayer
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/player/ClickableCommand.java#L38

Event


Namediscord button clicked
Event Lines discord button clicked
Triggerswhen a Discord user clicks a button.
Generated Exampleson discord button clicked:
after discord button clicked:
Switchesfor:<bot> to only process the event for a specified Discord bot.
channel:<channel_id> to only process the event when it occurs in a specified Discord channel.
group:<group_id> to only process the event for a specified Discord group.
id:<button_id> to only process the event for a specified Discord button.
Contexts<context.bot> returns the relevant DiscordBotTag.
<context.channel> returns the DiscordChannelTag.
<context.group> returns the DiscordGroupTag.
<context.interaction> returns the DiscordInteractionTag.
<context.button> returns the DiscordButtonTag.
<context.message> returns the relevant message the button was on.
GroupDiscord
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/events/DiscordButtonClickedScriptEvent.java#L10
Nameplayer click_type clicks item in inventory
Event Lines player (<click_type>) clicks (<item>) in <inventory>
Triggerswhen a player clicks in an inventory. Note that you likely will also want to listen to Event:player drags in inventory.
Generated Examplesafter player click_type clicks in inventory:
on player clicks in enderchest:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Switcheswith:<item> to only process the event if a specified cursor item was used.
in_area:<area> replaces the default 'in:<area>' for this event.
action:<action> to only process the event if a specified action occurred.
slot:<slot> to only process the event if a specified slot or slot_type was clicked. For slot input options, see Language:Slot Inputs.
Contexts<context.item> returns the ItemTag the player has clicked on.
<context.inventory> returns the InventoryTag (the 'top' inventory, regardless of which slot was clicked).
<context.clicked_inventory> returns the InventoryTag that was clicked in.
<context.cursor_item> returns the item the Player is clicking with.
<context.click> returns an ElementTag with the name of the click type. Click type list: 🔗https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/ClickType.html
<context.slot_type> returns an ElementTag with the name of the slot type that was clicked. Slot type list: 🔗https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryType.SlotType.html
<context.slot> returns an ElementTag with the number of the slot that was clicked.
<context.raw_slot> returns an ElementTag with the raw number of the slot that was clicked.
<context.is_shift_click> returns true if 'shift' was used while clicking.
<context.action> returns the inventory_action. See Language:Inventory Actions.
<context.hotbar_button> returns an ElementTag of the button pressed as a number, or 0 if no number button was pressed.
DetermineItemTag to set the current item for the event.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPlayer
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerClicksInInventoryScriptEvent.java#L70
Nameplayer right|left clicks block
Event Lines player (right|left) clicks <block>
Triggerswhen a player clicks on a block or in the air.
Generated Exampleson player left clicks waxed_cut_copper_stairs:
after player right clicks jungle_sign:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Switcheswith:<item> to only process the event if a specified item was held.
using:hand/off_hand/either_hand to only process the event if the specified hand was used to click.
type:<material> to only run if the block clicked matches the material input.
Contexts<context.item> returns the ItemTag the player is clicking with.
<context.location> returns the LocationTag the player is clicking on.
<context.relative> returns a LocationTag of the air block in front of the clicked block.
<context.click_type> returns an ElementTag of the Spigot API click type 🔗https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/Action.html.
<context.hand> returns an ElementTag of the used hand.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPlayer
Warning(s)this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.
this sometimes fires at unexpected times, eg when dropping an item.
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerClicksBlockScriptEvent.java#L22
Nameplayer right|left clicks fake entity
Event Lines player (right|left) clicks fake entity
Triggerswhen a player clicks a fake entity, one that is only shown to the player and not tracked by the server.
Generated Examplesafter player clicks fake entity:
on player clicks fake entity:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Contexts<context.entity> returns the EntityTag of the entity that was clicked. Note that this entity is not being tracked by the server, so many operations may not be possible on it.
This will return null if the player clicks a fake entity that was not spawned via Command:fakespawn.
<context.hand> returns an ElementTag of the hand used to click.
<context.click_type> returns an ElementTag of the click type (left/right).
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPaper
RequiresPaper
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/paper/src/main/java/com/denizenscript/denizen/paper/events/PlayerClicksFakeEntityScriptEvent.java#L16
Nameplayer right clicks entity
Event Lines player right clicks <entity>
Triggerswhen a player right clicks on an entity.
Generated Exampleson player right clicks item_display:
after player right clicks pufferfish:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Switcheswith:<item> to only process the event when the player is holding a specified item.
type:<entity> to only run if the entity clicked matches the entity input.
Contexts<context.entity> returns the EntityTag the player is clicking on.
<context.item> returns the ItemTag the player is clicking with.
<context.hand> returns "offhand" or "mainhand" to indicate which hand was used to fire the event. Some events fire twice - once for each hand.
<context.click_position> returns a LocationTag of the click position (as a world-less vector, relative to the entity's center). This is only available when clicking armor stands.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPlayer
Warning(s)this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions.
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerRightClicksEntityScriptEvent.java#L21

Language


NameClick Triggers
DescriptionClick Triggers are triggered when a player right clicks the NPC.

These are very basic with no extraneous complexity.


click trigger:
    script:
    - narrate "hi <player.name>"


They can optionally have an item matcher with multiple triggers, for the item in the player's hand. For example:

click trigger:
    1:
        trigger: my_item_script
        script:
        - narrate "Nice item script"
    2:
        trigger: stone
        script:
        - narrate "Nice vanilla item"
    3:
        script:
        - narrate "I don't recognize your held item"
GroupNPC Interact Scripts
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/ClickTrigger.java#L25

Tag


Name<&click[<click_command>].type[<type>]>
ReturnsElementTag
DescriptionReturns a special chat code that makes the following text execute the input command when clicked.
This tag must be followed by an <&end_click> tag.
Available command types: OPEN_URL, OPEN_FILE, RUN_COMMAND, SUGGEST_COMMAND, COPY_TO_CLIPBOARD, or CHANGE_PAGE.
For example: - narrate "You can <&click[https://denizenscript.com].type[OPEN_URL]>click here<&end_click> to learn about Denizen!"
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java#L84
Name<&click[<click_command>]>
ReturnsElementTag
DescriptionReturns a special chat code that makes the following text execute the input command line value when clicked.
To execute a command "/" should be used at the start. Otherwise, it will display as chat.
This tag must be followed by an <&end_click> tag.
For example: - narrate "You can <&click[wow]>click here<&end_click> to say wow!"
For example: - narrate "You can <&click[/help]>click here<&end_click> for help!"
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java#L67
Name<&end_click>
ReturnsElementTag
DescriptionReturns a special chat code that ends a '&click' tag.
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
Generated Example
- narrate <&end_click>
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java#L119
Name<ElementTag.click_chat[<message>]>
ReturnsElementTag
DescriptionAdds a click command to the element, which makes the element pseudo-chat the input message when clicked, for activating interact script chat triggers (Language:Chat Triggers).
This internally uses the command "/denizenclickable chat SOME MESSAGE HERE" (requires players have permission "denizen.clickable")
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
Example
- narrate "You can <element[click here].click_chat[hello]> to say hello to an NPC's interact script!"
Grouptext manipulation
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L526
Name<ElementTag.click_url[<url>]>
ReturnsElementTag
DescriptionAdds a click command to the element, which makes the element open the given URL when clicked.
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
Example
- narrate "You can <element[click here].custom_color[emphasis].on_hover[Click me!].click_url[https://denizenscript.com]> to learn about Denizen!"
Grouptext manipulation
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L512
Name<ElementTag.on_click[<command>]>
ReturnsElementTag
DescriptionAdds a click command to the element, which makes the element execute the input command when clicked.
To execute a command "/" should be used at the start. Prior to 1.19, leaving off the "/" would display the text as chat. This feature was removed as part of the 1.19 secure chat system.
For activating interact script chat triggers (Language:Chat Triggers), you can use the command "/denizenclickable chat SOME MESSAGE HERE" (requires players have permission "denizen.clickable")
For that, instead prefer Tag:ElementTag.click_chat
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
Example
- narrate "You can <element[click here].on_click[/help]> for help!"
Example
- narrate "You can <element[click here].on_click[/denizenclickable chat hello]> to say hello to an NPC's interact script!"
Grouptext manipulation
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L541
Name<ElementTag.on_click[<message>].type[<type>]>
ReturnsElementTag
DescriptionAdds a click command to the element, which makes the element execute the input command when clicked.
Available command types: OPEN_URL, OPEN_FILE, RUN_COMMAND, SUGGEST_COMMAND, COPY_TO_CLIPBOARD, or CHANGE_PAGE.
For example: - narrate "You can <element[click here].on_click[https://denizenscript.com].type[OPEN_URL]> to learn about Denizen!"
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
For run_command, prefer Tag:ElementTag.on_click
For chat, prefer Tag:ElementTag.click_chat
For URLs, prefer Tag:ElementTag.click_url
Grouptext manipulation
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L559

Semi-Strong Match Results



Event


Nameplayer drags in inventory
Event Lines player drags in inventory
player drags (<item>) (in <inventory>)
Triggerswhen a player drags in an inventory (that is, clicks and then holds the mouse button down while moving the mouse across multiple slots).
Generated Examplesafter player drags in inventory:
on player drags item in furnace:
on player drags glass_bottle:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Switchesin_area:<area> replaces the default 'in:<area>' for this event.
drag_type:<type> to only run the event if the given drag type (SINGLE or EVEN) was used.
Contexts<context.item> returns the ItemTag the player has dragged.
<context.inventory> returns the InventoryTag (the 'top' inventory, regardless of which slot was clicked).
<context.clicked_inventory> returns the InventoryTag that was clicked in.
<context.slots> returns a ListTag of the slot numbers dragged through.
<context.raw_slots> returns a ListTag of the raw slot numbers dragged through.
<context.drag_type> returns either SINGLE or EVEN depending on whether the player used their left or right mouse button.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPlayer
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerDragsInInvScriptEvent.java#L25
Nameplayer opens sign
Event Lines player opens sign
TriggersWhen a player opens a sign (eg after placing a sign, or by clicking on it to edit it).
Generated Exampleson player opens sign:
after player opens sign:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Contexts<context.side> returns an ElementTag of the side of the sign that was clicked (FRONT or BACK).
<context.cause> returns an ElementTag of reason the sign was opened - see 🔗https://jd.papermc.io/paper/1.20/io/papermc/paper/event/player/PlayerOpenSignEvent.Cause.html.
<context.location> returns a LocationTag of the sign's location.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPaper
RequiresPaper
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/paper/src/main/java/com/denizenscript/denizen/paper/events/PlayerOpenSignScriptEvent.java#L15

Semi-Decent Match Results



Command


Namediscordcommand
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordcommand (id:<bot>) [create/delete] (group:<group>) (name:<name>) (type:{slash}/user/message) (description:<description>) (options:<options>)
Short DescriptionManages Discord application commands.
Full DescriptionManages Discord application commands.

You can create a new command, edit the permissions of an existing command, or delete an existing command.

To create (or delete) a command in a specific Discord guild, use the "group" argument. If not present, a global command will be created. NOTE: Global commands take up to an hour to register.
When creating, both a name and description are required.

Commands can be slash commands - activated via typing "/", message commands - activated by right-clicking a message, or user commands - activated by right-clicking a user.
"Description" and "options" are only valid for slash commands.

The "options" argument controls the command parameters. It is a MapTag of ordered MapTags that can sometimes hold ordered MapTags. It is recommended to use Command:definemap or a data script key when creating commands.
All option MapTags must have "type", "name", and "description" keys, with an optional "required" key (defaulting to true). The "type" key can be one of: STRING, INTEGER, BOOLEAN, USER, CHANNEL, ROLE, MENTIONABLE, NUMBER, ATTACHMENT.
Additionally, the option map can include a "choices" key, which is a MapTag of ordered MapTags that have a "name" (what displays to the user) and a "value" (what gets passed to the client).
Instead of choices, the option map can also include an "autocomplete" key controlling whether dynamic suggestions can be provided to the client (defaulting to false). See Event:on discord command autocomplete.

Editing application command permissions has been moved to the "Integrations" section in the server settings.
Read more about it here: 🔗https://discord.com/blog/slash-commands-permissions-discord-apps-bots

You DO NOT need to create a command on startup every time! Once a command is created, it will persist until you delete it.
Using the "create" instruction on an existing command will update it.

Commands and replies to interactions have limitations. See 🔗https://gist.github.com/MinnDevelopment/b883b078fdb69d0e568249cc8bf37fe9.

See also Discord's internal API documentation for commands: 🔗https://discord.com/developers/docs/interactions/application-commands

Generally used alongside Command:discordinteraction

The command should usually be ~waited for. See Language:~waitable.
Related Tags<entry[saveName].command> returns the DiscordCommandTag of a command upon creation, when the command is ~waited for.
Usage Example
# Use to create a simple slash command without options and save it.
- ~discordcommand create group:<discord[mybot].group[Denizen]> name:hello "description:Hello world!" save:mycmd
- debug log <entry[mycmd].command.name>
Usage Example
# Use to create a global slash command with one option, using definemap.
- definemap options:
    1:
      type: string
      name: animal
      description: Your favorite animal
      required: true
- ~discordcommand id:mybot create name:animal "description:Pick your favorite!" options:<[options]>
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordCommandCommand.java#L40
Namediscordmessage
Related Guide Pagehttps://guide.denizenscript.com/guides/expanding/ddiscordbot.html
Syntaxdiscordmessage (id:<id>) [reply:<message>/edit:<message>/channel:<channel>/user:<user>] (<message>) (no_mention) (rows:<rows>) (embed:<embed>|...) (attach_files:<map>) (post_title:<name>)
Short DescriptionSends a message to a Discord channel.
Full DescriptionSends a message to a Discord channel.

Command may fail if the bot does not have permission within the Discord group to send a message in that channel.

You can send the message to: a channel, user, or in reply to a previous message.
If sending as a reply, optionally use "no_mention" to disable the default reply pinging the original user.

Channels can be specified as either a copied ID, or using any tag that returns a valid DiscordChannelTag.
To get IDs, enable "Developer Mode" in your Discord settings, then right click on the channel and press "Copy ID".

You can edit an existing message by using "edit:<message>".

You can use "attach_file_name:<name>" and "attach_file_text:<text>" to attach a text file with longer content than a normal message allows.
Alternatively, you can use "attach_files:<map>" to attach files as a MapTag of the name of the file to the text or a BinaryTag.

To send embeds, use "embed:<embed>|...".

You can use "rows" to attach action rows of components, such as buttons to the message, using ObjectType:DiscordButtonTag, and ObjectType:DiscordSelectionTag.

You can send a message into a Forum Channel with "post_title" specified to create a post in that forum.

The command can be ~waited for. See Language:~waitable.
Related Tags<entry[saveName].message> returns the DiscordMessageTag of the sent message, when the command is ~waited for.
<discord[mybot].group[Denizen].channel[bot-spam]> is an example of a tag that will return an appropriate channel object for a named channel in a named group.
Usage Example
# Use to message a Discord channel with a copied channel ID.
- discordmessage id:mybot channel:1234 "Hello world!"
Usage Example
# Use to reply to a message from a message received event.
- discordmessage id:mybot reply:<context.message> "Hello world!"
Usage Example
# Use to message an embed to a Discord channel.
- discordmessage id:mybot channel:1234 embed:<discord_embed[title=hi;description=this is an embed!]>
Usage Example
# Use to message a Discord channel and record the new message ID.
- ~discordmessage id:mybot channel:1234 "Hello world!" save:sent
- announce "Sent as <entry[sent].message.id>"
Usage Example
# Use to send a message to a user through a private channel.
- discordmessage id:mybot user:<[user]> "Hello world!"
Usage Example
# Use to send a short and simple text-file message to a channel.
- discordmessage id:mybot channel:<[channel]> attach_files:<map[quote.xml=<&lt>mcmonkey<&gt> haha text files amirite<n>gotta abuse em]>
Usage Example
# Use to send a message and attach a button to it.
- define my_button <discord_button.with_map[style=primary;id=my_button;label=Hello]>
- discordmessage id:mybot channel:<[channel]> rows:<[my_button]> "Hello world!"
Usage Example
# Use to send a message to a Discord channel, then edit it after 5 seconds.
- ~discordmessage id:mybot channel:<[channel]> "Hello world!" save:msg
- wait 5s
- discordmessage id:mybot edit:<entry[msg].message> "Goodbye!"
Usage Example
# Use to send multiple embeds in a single message
- ~discordmessage id:mybot channel:<[channel]> embed:<discord_embed[title=embed 1]>|<discord_embed[title=embed 2]>
Usage Example
# Use to send files in a single message, including an image file, using a MapTag.
- ~fileread path:my_information.yml save:info
- ~fileread path:my_image.png save:image
- definemap files:
    text.txt: Wow! Denizen is so cool!
    info.yml: <entry[info].data>
    my_image.png: <entry[image].data>
- ~discordmessage id:mybot channel:<[channel]> attach_files:<[files]>
Groupexternal
RequiresdDiscordBot
Sourcehttps://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordMessageCommand.java#L43
NamePlaySound
Syntaxplaysound (<location>|...) (<player>|...) [sound:<name>] (volume:<#.#>) (pitch:<#.#>) (custom) (sound_category:<category_name>)
Short DescriptionPlays a sound at the location or to a list of players.
Full DescriptionPlays a sound to a player or nearby players at a location.
The sound is played through the player's client just like any other sounds in Minecraft.

For a list of all sounds, check 🔗https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html

Sounds are by default played under their normal sound type (eg zombie sounds are under the type Mobs/Animals).
You can optionally instead specify an alternate sound category to use.
For a list of all valid sound categories, check 🔗https://hub.spigotmc.org/javadocs/spigot/org/bukkit/SoundCategory.html

Specifying a player or list of players will only play the sound for each player, from their own location (but will not follow them if they move).
If a location is specified, it will play the sound for any players that are near the location specified.
If both players and locations are specified, will play the sound for only those players at those locations.

Optionally, specify 'custom' to play a custom sound added by a resource pack, changing the sound name to something like 'random.click'

Optionally specify a pitch value (defaults to 1.0). A pitch from 0.0 to 1.0 will be deeper (sounds like a demon), and above 1.0 will be higher pitched (sounds like a fairy).

Optionally specify a volume value (defaults to 1.0). A volume from 0.0 to 1.0 will be quieter than normal.
A volume above 1.0 however will not be louder - instead it will be audible from farther (approximately 1 extra chunk of distance per value, eg 2.0 is 2 more chunks, 5.0 is 5 more chunks, etc.).
Related Tags<server.sound_types> Deprecated in favor of Tag:server.sound_keys on MC 1.21+.
Usage Example
# Use to play a sound for a player
- playsound <player> sound:ENTITY_EXPERIENCE_ORB_PICKUP pitch:1
Usage Example
# Use to play a sound at a location for all nearby
- playsound <player.location> sound:ENTITY_PLAYER_LEVELUP
Usage Example
# Use to notify all players with a sound
- playsound <server.online_players> sound:ENTITY_PLAYER_LEVELUP volume:0.5 pitch:0.8
Synonyms (Search Aid)noise
Groupworld
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlaySoundCommand.java#L32
NameSwitch
Syntaxswitch [<location>|...] (state:{toggle}/on/off) (duration:<value>) (no_physics)
Short DescriptionSwitches state of the block.
Full DescriptionChanges the state of a block at the given location, or list of blocks at the given locations.

Optionally specify "state:on" to turn a block on (or open it, or whatever as applicable) or "state:off" to turn it off (or close it, etc).
By default, will toggle the state (on to off, or off to on).

Optionally specify the "duration" argument to set a length of time after which the block will return to the original state.

Works on any interactable blocks, including:
- the standard toggling levers, doors, gates...
- Single-use interactables like buttons, note blocks, dispensers, droppers, ...
- Redstone interactables like repeaters, ...
- Special interactables like tripwires, ...
- Bells as a special case will ring when you use 'switch' on them, ...
- Almost any other block with an interaction handler.

This will generally (but not always) function equivalently to a user right-clicking the block
(so it will open and close doors, flip levers on and off, press and depress buttons, ...).

Optionally specify 'no_physics' to not apply a physics update after switching.
Related Tags<LocationTag.switched> Returns whether the block at the location is considered to be switched on. (...)
<MaterialTag.switched> Returns whether a material is 'switched on', which has different semantic meaning depending on the material type. (...)
Usage Example
# At the player's location, switch the state of the block to on, no matter what state it was in before.
- switch <player.location> state:on
Usage Example
# Opens a door that the player is looking at.
- switch <player.cursor_on> state:on
Usage Example
# Toggle a block at the player's foot location.
- switch <player.location>
Synonyms (Search Aid)toggle, lever, activate, power, redstone
Groupworld
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SwitchCommand.java#L37
NameTrigger
Related Guide Pagehttps://guide.denizenscript.com/guides/npcs/interact-scripts.html
Syntaxtrigger [name:<trigger>] (state:{toggle}/true/false) (cooldown:<duration>) (radius:<#>)
Short DescriptionEnables or disables a trigger.
Full DescriptionThis command enables or disables an interact script trigger for the linked NPC.
This is generally meant to be used within the 'on assignment' action in an assignment script.
This might also be useful on timed activations or other special events (such as an NPC that "goes to bed" at the end of the day,
you might disable the proximity trigger that would otherwise normally show a greeting message).

The "name" argument is required, and can have any supported trigger name.
The 4 triggers available by default are chat, click, damage, and proximity.
For more details of the available trigger types, refer to Language:Interact Script Triggers.

The "state" argument can be 'true' (to enable it), 'false' (to disable it),
or unspecified to toggle it (that is, enable if it's currently off, or disable if it's currently on).

You can specify the "cooldown" argument to set how long the trigger must wait
after any firing before it can be fired again.

You can specify the "radius" argument to set how far away a player can be when activating it.
Note that the way this applies varies from trigger to trigger.
For the "chat" trigger, a large radius can be easily accidentally triggered by unrelated chatter.
For the "proximity" trigger, the radius argument should almost always be specified, as you generally want to control this with care.
For the "click" and "damage" trigger, the radius argument will be ignored.
Related Tags<NPCTag.has_trigger[<trigger>]> Returns whether the NPC has a specified trigger.
Usage Example
# Use to enable the click trigger.
- trigger name:click state:true
Usage Example
# Use to enable the chat trigger with a 10-second cooldown and a radius of 5 blocks.
- trigger name:chat state:true cooldown:10s radius:5
Usage Example
# Use to disable the proximity trigger.
- trigger name:proximity state:false
Groupnpc
RequiresCitizens
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/npc/TriggerCommand.java#L24

Event


Namecrackshot player fires projectile
Event Lines crackshot player fires projectile
Triggersjust before a projectile is launched from a CrackShot weapon.
Generated Examplesafter crackshot player fires projectile:
on crackshot player fires projectile:
Has PlayerAlways - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Contexts<context.weapon> returns the name of the weapon about to fire.
<context.bullet_spread> returns the spread of the projectiles being fired.
<context.left_click> returns whether the fire was a left click.
<context.shot_sounds> returns a list of the shot sounds.
Determine"BULLET_SPREAD:<ElementTag(Number)>" to set the bullet spread.
"SHOT_SOUNDS:<ElementTag>" to set the shot sounds. Use "NONE" to have no sound. 🔗https://github.com/Shampaggon/CrackShot/wiki/The-Complete-Guide-to-CrackShot#sounds
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
GroupDepenizen
RequiresDepenizen, CrackShot
Sourcehttps://github.com/DenizenScript/Depenizen/blob/master/src/main/java/com/denizenscript/depenizen/bukkit/events/crackshot/CrackShotPlayerFiresProjectileEvent.java#L19
Nameplayer crafts item
Event Lines player crafts item
player crafts <item>
Triggerswhen a player fully crafts an item.
Generated Examplesafter player crafts item:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Contexts<context.inventory> returns the InventoryTag of the crafting inventory.
<context.item> returns the ItemTag to be crafted.
<context.amount> returns the amount of the item that will be crafted (usually 1, except when shift clicked. Can be above 64).
<context.recipe> returns a ListTag of ItemTags in the recipe.
<context.recipe_id> returns the ID of the recipe that is being crafted.
<context.click_type> returns an ElementTag with the name of the click type. Click type list: 🔗https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/ClickType.html
DetermineItemTag to change the item that is crafted.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
GroupPlayer
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerCraftsItemScriptEvent.java#L25
Nameplayer empties bucket
Event Lines player empties bucket
player empties <item>
Triggerswhen a player empties a bucket.
Generated Exampleson player empties bucket:
after player empties item:
after player empties grindstone:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Contexts<context.item> returns the ItemTag of the bucket being emptied (just material, other properties are lost - use 'player.item_in_hand' if you need full data).
<context.location> returns the LocationTag of the block clicked with the bucket.
<context.relative> returns the LocationTag of the block in front of the clicked block.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPlayer
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerEmptiesBucketScriptEvent.java#L17
Nameplayer fills bucket
Event Lines player fills bucket
player fills <item>
Triggerswhen a player fills a bucket.
Generated Examplesafter player fills bucket:
after player fills blackstone_stairs:
on player fills bucket:
after player fills diorite_wall:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Contexts<context.item> returns the ItemTag of the filled bucket.
<context.location> returns the LocationTag of the block clicked with the bucket.
<context.material> returns the MaterialTag of the LocationTag.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPlayer
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerFillsBucketScriptEvent.java#L17
Nameplayer uses recipe book
Event Lines player uses recipe book
Triggerswhen a player interacts with their recipe book.
Generated Exampleson player uses recipe book:
Has PlayerAlways. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Contexts<context.recipe> returns the key of the recipe that was clicked.
<context.is_all> returns 'true' if the player is trying to make the maximum amount of items from the recipe, otherwise 'false'.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...
GroupPaper
RequiresPaper
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/paper/src/main/java/com/denizenscript/denizen/paper/events/PlayerClicksInRecipeBookScriptEvent.java#L14

Language


NameAdvanced Object Matchables
DescriptionScript events have a variety of matchable object inputs, and the range of inputs they accept may not always be obvious.
For example, an event might be "player clicks <block>"... what can "<block>" be filled with?

"<block>" usually indicates that a LocationTag and/or MaterialTag will be matched against.
This means you can specify any valid block material name, like "stone" or "air", like "on player clicks stone:" (will only run the event if the player is clicking stone)
You can also use a catch-all such as "block", like "on player clicks block:" (will always run the event when the player clicks anything/anywhere)
You can also use some more complicated matchables such as "vanilla_tagged:", like "on player clicks vanilla_tagged:mineable/axe:" (will run if the block is mineable with axes)
(For more block-related options, refer to the ObjectType:LocationTag and ObjectType:MaterialTag matchers lists.)

Many object types can be used for matchables, the valid inputs are unique depending on the object type involved.

Some inputs don't refer to any object at all - they're just advanced matchers for some generic plaintext,
for example "<cause>" implies an enumeration of causes will be matched against.

Many inputs support advanced matchers. For details on that, see Language:Advanced Object Matching.

A common matchable type found among different objects is a Flag Matchable. This usually looks like "item_flagged:<flag>"
This matches if the object has the specified flag, and fails to match if the object doesn't have that flag.
You can specify multiple required flags with '|', like "item_flagged:a|b|c", which will match if-and-only-if the item has ALL the flags named.
They can also be used to require the object does NOT have the flag with a "!" like "item_flagged:!<flag>".
When using multiple flags with "|", the "!" is per-entry, so "item_flagged:!a|b" requires the item DOES have 'b' but does NOT have 'a'.

Note also that in addition to events, tags often also have matchables as input params,
usually documented like ".types[<matcher>]", with tag documentation specifying what matcher is used,
or like "<material_matcher>" to indicate in this example specifically MaterialTag matchables are allowed.

Not all object types have defined matchable options, and those that do list them in their ObjectType meta. For an example of this, check ObjectType:ItemTag.

As a special case, "in:<area>" style matchable listings in event conform to the following option set:
"biome:<name>": matches if the location is in a given biome, using advanced matchers.
"cuboid" plaintext: matches if the location is in any noted cuboid.
"ellipsoid" plaintext: matches if the location is in any noted ellipsoid.
"polygon" plaintext: matches if the location is in any noted polygon.
"chunk_flagged:<flag>": a Flag Matchable for ChunkTag flags.
"area_flagged:<flag>": a Flag Matchable for AreaObject flags.
Area note name: matches if an AreaObject note that matches the given advanced matcher contains the location.
If none of the above are used, uses WorldTag matchers.
GroupObject System
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/BukkitScriptEvent.java#L45
NameChat Triggers
DescriptionChat Triggers are triggered when a player chats to the NPC (usually while standing close to the NPC and facing the NPC).

They can also be triggered by the command "/denizenclickable chat hello" (where 'hello' is replaced with the chat message). This is used for clickable triggers.
This option enforces all the same limitations as chatting directly, but unlike real chat, won't display the message in global chat when there's no match.
This requires players have the permission "denizen.clickable".

Interact scripts are allowed to define a list of possible messages a player may type and the scripts triggered in response.

Within any given step, the format is then as follows:

# Some identifier for the trigger, this only serves to make the sub-triggers unique, and sort them (alphabetically).
1:
    # The trigger message written by a player. The text between // must be typed by a player, the other text is filled automatically.
    trigger: /keyword/ othertext
    script:
    # Your code here
    - wait 1
    # use "<context.message>" for the exact text written by the player.
    - chat "<context.message> eh?"
# You can list as many as you want
2:
    # You can have multi-option triggers, separated by pipes (the "|" symbol). This example matches if player types 'hi', 'hello', OR 'hey'.
    trigger: /hi|hello|hey/
    script:
    - wait 1
    # use "<context.keyword>" for the specific word that was said.
    # this example will respond to players that said 'hi' with "hi there buddy!", 'hello' with "hello there buddy!", etc.
    - chat "<context.keyword> there buddy!"
3:
    # You can have regex triggers. This example matches when the player types any numbers.
    trigger: /regex:\d+/
    script:
    - wait 1
    # use "<context.keyword>" for the text matched by the regex matcher.
    - chat "<context.keyword> eh?"
4:
    # Use '*' as the trigger to match anything at all.
    trigger: /*/
    # Add this line to hide the "[Player -> NPC]: hi" initial trigger message.
    hide trigger message: true
    # Add this line to show the player chat message in the normal chat.
    show as normal chat: true
    script:
    # If you hide the trigger message but not show as normal chat, you might want to fill that spot with something else.
    - narrate "[Player -> NPC]: I don't know how to type the right thing"
    - wait 1
    - chat "Well type 'hello' or any number!"
    - narrate "Click <element[here].on_hover[click me!].on_click[/denizenclickable chat hello]> to auto-activate the 'hello' trigger!"
GroupNPC Interact Scripts
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/ChatTrigger.java#L40
NameDamage Triggers
DescriptionDamage Triggers are triggered when when a player left clicks the NPC.
Despite the name, these do not actually require the NPC take any damage, only that the player left clicks the NPC.

In scripts, use <context.damage> to measure how much damage was done to the NPC
(though note that invincible NPCs don't necessarily take any damage even when this is non-zero).

These are very basic with no extraneous complexity.
GroupNPC Interact Scripts
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/DamageTrigger.java#L30
NameDenizen Permissions
DescriptionThe following is a list of all permission nodes Denizen uses within Bukkit.

denizen.clickable # use the 'denizenclickable' command, which is automatically executed when using Command:clickable and for clickable chat triggers
denizen.basic # use the basics of the /denizen command
denizen.ex # use the /ex command
denizen.debug # use the /denizen debug command
denizen.submit # use the /denizen submit command

Additionally:
denizen.npc.health, denizen.npc.sneak,
denizen.npc.effect, denizen.npc.fish, denizen.npc.sleep, denizen.npc.stand,
denizen.npc.sit, denizen.npc.nameplate, denizen.npc.nickname, denizen.npc.trigger,
denizen.npc.assign, denizen.npc.constants, denizen.npc.pushable

However, we recommend just giving op to whoever needs to access Denizen - they can op themselves through Denizen anyway, why not save the trouble?
( EG, /ex execute as_server "op <player.name>" )
GroupConsole Commands
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/utilities/command/DenizenCommandHandler.java#L30
NameDenizen Text Formatting
DescriptionDenizen provides a variety of special chat format options like "on_hover" and "on_click".
These options exist within Denizen and do not appear in the historical Minecraft legacy chat format that most plugins and systems read.
That legacy system has 16 colors (0-9, A-F) and a few toggleable formats (bold, italic, etc). It does not contain anything that needs more than just an on/off.

Modern Minecraft, however, supports a JSON based "raw" message format that can do click events, hover events, full RGB colors, etc.

Denizen therefore has its own internal system that works like the legacy format system, but also supports the new options normally only available as 'raw JSON'.

Because it is entirely processed within Denizen, these options only work within Denizen, when performing actions that support raw JSON input.
This magic tool exists to let you write messages without having to write the messy JSON.

Be aware that many inputs do not support raw JSON, and as such are limited only the historical Minecraft legacy format.
Also be aware that click events, hover events, etc. are exclusively limited to the chat bar and the pages of books, as you cannot mouse over anything else.

Also note that RGB colors use a format that Spigot invented, meaning they will work in places that use Spigot's parser OR Denizen's version, but nowhere that uses the vanilla format still.

Thanks to Paper's implementation of component APIs where Spigot was too lazy to, Paper servers have advanced text formatting available in more areas.
GroupDenizen Magic
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/utilities/FormattedTextHelper.java#L22
NameHealth Trait
DescriptionBy default, NPCs are invulnerable, unable to be damaged. If you want your NPC
to be able to take damage, or use the left click as an interaction, it must
have the health trait. The Health trait is automatically enabled if you set
the damage trigger state to true.

You can use the denizen vulnerable command to make your NPCs react to left
click, but not take damage. - vulnerable state:false

Enable Damage trigger via dScript: - trigger name:damage state:true
Enable Health trait via dScript: - trait state:true health
Enable Health trait via npc command: /npc health --set # (-r)

Enable automatic respawn (default delay 300t): /npc health --respawndelay [delay as a duration]
Set respawn location: - flag <npc> respawn_location:<location>

Related Tags
Tag:EntityTag.health
Tag:EntityTag.formatted_health
Tag:EntityTag.health_max
Tag:EntityTag.health_percentage
Tag:NPCTag.has_trait[health]

Related Mechanisms
Mechanism:EntityTag.health
Mechanism:EntityTag.max_health

Related Commands
Command:heal
Command:health
Command:vulnerable

Related Actions
Action:on damage
Action:on damaged
Action:on no damage trigger
GroupNPC Traits
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/npc/traits/HealthTrait.java#L29
NameInteract Script Containers
DescriptionInteract script containers are used to handle NPC triggers.

Interact scripts must be referenced from an assignment script container to be of any use.
See Language:assignment script containers.

The only required key on an interact script container is the 'steps:' key.

Within the steps key is a list of steps,
where the first step is '1', 'default', or any step that contains a '*' symbol.
After that, any steps must be 'zapped' to via the zap command: Command:zap.

Each step contains a list of trigger types that it handles, and the relevant handling that the given
trigger makes available.

Refer to Language:interact script triggers for documentation about the triggers available.
Any triggers used must be enabled in Action:assignment by Command:trigger.

Note that script commands ran in interact scripts by default have a delay between each command.
To override this delay, set 'speed: 0' on the container or change the relevant config setting.

Interact scripts can be automatically disabled by adding "enabled: false" as a root key (supports any load-time-parseable tags).


Interact_Script_Name:

    type: interact

    # | All interact scripts MUST have this key!
    steps:

        # The first step
        1:
            # Any trigger type here
            click trigger:
                script:
                    # Handle what happens when the NPC is clicked during step 1
                    - some commands
            # Other triggers here
        # other steps here

GroupScript Container System
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/containers/core/InteractScriptContainer.java#L19
NameInteract Script Triggers
DescriptionInteract script triggers are the most basic components of standard NPC scripting.
They're very useful for NPCs that give quests or have other very basic interactions with players.
While less powerful that other tools that Denizen provides, they can be very straightforward and clear to use in many simpler cases.

Note that triggers have a default cooldown system built in to prevent users from clicking too rapidly.
However these are very short cooldowns by default - when you need a longer cooldown, use
Command:cooldown or Command:engage.

Triggers go in Language:interact script containers.

The available default trigger types are Language:click triggers,
Language:damage triggers, Language:chat triggers, and Language:proximity triggers.
GroupNPC Interact Scripts
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/containers/core/InteractScriptContainer.java#L67
NameInventory Actions
DescriptionUsed by some inventory world events to describe the action of the inventory event.

Actions, as described by the bukkit javadocs:
CLONE_STACK
A max-size stack of the clicked item is put on the cursor.
COLLECT_TO_CURSOR
The inventory is searched for the same material, and they are put on the cursor up to
MaterialTag.max_stack_size.
DROP_ALL_CURSOR
The entire cursor item is dropped.
DROP_ALL_SLOT
The entire clicked slot is dropped.
DROP_ONE_CURSOR
One item is dropped from the cursor.
DROP_ONE_SLOT
One item is dropped from the clicked slot.
HOTBAR_MOVE_AND_READD
The clicked item is moved to the hotbar, and the item currently there is re-added to the
player's inventory.
HOTBAR_SWAP
The clicked slot and the picked hotbar slot are swapped.
MOVE_TO_OTHER_INVENTORY
The item is moved to the opposite inventory if a space is found.
NOTHING
Nothing will happen from the click.
PICKUP_ALL
All of the items on the clicked slot are moved to the cursor.
PICKUP_HALF
Half of the items on the clicked slot are moved to the cursor.
PICKUP_ONE
One of the items on the clicked slot are moved to the cursor.
PICKUP_SOME
Some of the items on the clicked slot are moved to the cursor.
PLACE_ALL
All of the items on the cursor are moved to the clicked slot.
PLACE_ONE
A single item from the cursor is moved to the clicked slot.
PLACE_SOME
Some of the items from the cursor are moved to the clicked slot (usually up to the max stack size).
SWAP_WITH_CURSOR
The clicked item and the cursor are exchanged.
UNKNOWN
An unrecognized ClickType.
GroupUseful Lists
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerClicksInInventoryScriptEvent.java#L20
NameInventory Script Containers
DescriptionInventory script containers are an easy way to pre-define custom inventories for use within scripts.
Inventory scripts work with the InventoryTag object, and can be fetched with the Object Fetcher by using the
InventoryTag constructor InventoryTag_script_name.

Example: - inventory open d:MyInventoryScript

The following is the format for the container.

The 'inventory:' key is required, other keys vary based on the type.
Some types will require you define either 'size:' or 'slots:' (or both).
'Procedural items:' and 'definitions:' are optional, and should only be defined if needed.


# The name of the script is the same name that you can use to construct a new
# InventoryTag based on this inventory script. For example, an inventory script named 'Super_Cool_Inventory'
# can be referred to as 'Super_Cool_Inventory'.
Inventory_Script_Name:

    type: inventory

    # Must be a valid inventory type.
    # Valid inventory types: ANVIL, BREWING, CHEST, DISPENSER, ENCHANTING, ENDER_CHEST, HOPPER, WORKBENCH
    # | All inventory scripts MUST have this key!
    inventory: inventory type

    # The title can be anything you wish. Use color tags to make colored titles.
    # Note that titles only work for some inventory types, including ANVIL, CHEST, DISPENSER, FURNACE, ENCHANTING, HOPPER, WORKBENCH
    # | MOST inventory scripts should have this key!
    title: custom title

    # The size must be a multiple of 9. It is recommended to not go above 54, as it will not show correctly when a player looks into it.
    # | Some inventory scripts should have this key! Most can exclude it if 'slots' is used.
    size: 27

    # Set 'gui' to 'true' to indicate that the inventory is a GUI, meaning it's a set of buttons to be clicked, not a container of items.
    # This will prevent players from taking items out of or putting items into the inventory.
    # | SOME inventory scripts should have this key!
    gui: true

    # You can use definitions to define items to use in the slots. These are not like normal script definitions, and do not need to be in a definition tag.
    # | Some inventory scripts MAY have this key, but it is optional. Most scripts will just specify items directly.
    definitions:
        my item: ItemTag
        other item: ItemTag

    # Procedural items can be used to specify a list of ItemTags for the empty slots to be filled with.
    # Each item in the list represents the next available empty slot.
    # When the inventory has no more empty slots, it will discard any remaining items in the list.
    # A slot is considered empty when it has no value specified in the slots section.
    # If the slot is filled with air, it will no longer count as being empty.
    # | Most inventory scripts should exclude this key, but it may be useful in some cases.
    procedural items:
    - define list <list>
    - foreach <server.online_players>:
        # Insert some form of complex doesn't-fit-in-just-a-tag logic here
        - define item <[value].skull_item>
        - define list:->:<[item]>
    - determine <[list]>

    # You can specify the items in the slots of the inventory. For empty spaces, simply put an empty "slot" value, like "[]".
    # | Most inventory scripts SHOULD have this key!
    slots:
    - [] [] [] [my item] [ItemTag] [] [other item] [] []
    - [my item] [] [] [] [] [ItemTag] [ItemTag] [] []
    - [] [] [] [] [] [] [] [] [other item]
GroupScript Container System
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/containers/core/InventoryScriptContainer.java#L26
NameSafety In Events
DescriptionOne of the more common issues in Denizen scripts (particularly ones relating to inventories) is
*event safety*. That is, using commands inside an event that don't get along with the event.

The most common example of this is editing a player's inventory, within an inventory-related event.
Generally speaking, this problem becomes relevant any time an edit is made to something involved with an event,
within the firing of that event.
Take the following examples:

on player clicks in inventory:
- take iteminhand
on entity damaged:
- remove <context.entity>


In both examples above, something related to the event (the player's inventory, and the entity being damaged)
is being modified within the event itself.
These break due a rather important reason: The event is firing before and/or during the change to the object.
Most events operate this way. A series of changes *to the object* are pending, and will run immediately after
your script does... the problems resultant can range from your changes being lost to situational issues
(eg an inventory suddenly being emptied entirely) to even server crashes!
The second example event also is a good example of another way this can go wrong:
Many scripts and plugins will listen to the entity damage event, in ways that are simply unable to handle
the damaged entity just being gone now (when the event fires, it's *guaranteed* the entity is still present
but that remove command breaks the guarantee!).

The solution to this problem is simple: Use "after" instead of "on".

after player clicks in inventory:
- take iteminhand
after entity damaged:
- if <context.entity.is_spawned||false>:
  - remove <context.entity>

This will delay the script until *after* the event is complete, and thus outside of the problem area.
And thus should be fine. One limitation you should note is demonstrated in the second example event:
The normal guarantees of the event are no longer present (eg that the entity is still valid) and as such
you should validate these expectations remain true after the event (as seen with the 'if is_spawned' check).
(See also Language:Script Event After vs On)

If you need determine changes to the event, you can instead use 'on' but add a 'wait 1t' after the determine but before other script logic.
This allows the risky parts to be after the event and outside the problem area, but still determine changes to the event.
Be sure to use 'passively' to allow the script to run in full.

on player clicks in inventory:
- determine passively cancelled
- wait 1t
- take iteminhand
on entity damaged:
- determine passively cancelled
- wait 1t
- if <context.entity.is_spawned||false>:
  - remove <context.entity>
GroupScript Events
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/BukkitScriptEvent.java#L934

Mechanism


Namemax_stack_size
ObjectMaterialTag
InputElementTag(Number)
Related Tags<MaterialTag.max_stack_size> Returns the maximum amount of this material that can be held in a stack.
DescriptionSets the maximum stack size for all items this material type.
Note that altering this will probably require a script performing "- inventory update" in the event "after player clicks in inventory:" to maintain sync.
The maximum the client will interact with is stacks of 64, however you can set the max up to 127 and the client will render it, but refuse to move stacks properly.
Generated Example
- adjust <material[stone]> max_stack_size:3
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java#L742

ObjectType


NameTradeTag
Prefixtrade@
Base TypeElementTag
ImplementsPropertyHolderObject
Identity FormatThe identity format for trades is just the text 'trade'. All other data is specified through properties.
DescriptionMerchant trades are the parts of a special merchant inventory that is typically viewed by right clicking
a villager entity. Any number of trades can fit in a single merchant inventory.

Trades are represented by TradeTags.

The properties that can be used to customize a merchant trade are:

result=<item>
inputs=<item>(|<item>)
uses=<number of uses>
max_uses=<maximum number of uses>
has_xp=true/false

For example, the following command opens a virtual merchant inventory with two merchant trades.
The first trade offers a sponge for two emeralds, can be used up to 10 times,
and offers XP upon a successful transaction.
The second trade has zero maximum uses and displays a barrier in the input and output slots.

- opentrades trade[max_uses=10;inputs=emerald[quantity=2];result=sponge]|trade[inputs=barrier;result=barrier]
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/TradeTag.java#L17

Tag


Name<&insertion[<message>]>
ReturnsElementTag
DescriptionReturns a special chat code that makes the following text insert the input message to chat when shift-clicked.
This tag must be followed by an <&end_insertion> tag.
For example: - narrate "You can <&insertion[wow]>click here<&end_insertion> to add 'wow' to your chat!"
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java#L102
Name<ElementTag.strip_color>
ReturnsElementTag
DescriptionReturns the element with all color encoding stripped.
This will remove any/all colors, formats (bold/italic/etc), advanced formats (fonts/clickables/etc), and translate any translatables (&translate, &score, etc).
This will automatically translate translatable sections
Generated Example
- narrate <element[hello_world].strip_color>
Grouptext manipulation
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L346
Name<ElementTag.with_insertion[<message>]>
ReturnsElementTag
DescriptionAdds an insertion message to the element, which makes the element insert the input message to chat when shift-clicked.
Note that this is a magic Denizen tool - refer to Language:Denizen Text Formatting.
Grouptext manipulation
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L580
Name<EntityTag.last_interaction>
ReturnsMapTag
DescriptionReturns an interaction entity's last right click interaction, if any.
The returned map contains:
- 'player' (PlayerTag): the player who interacted
- 'duration' (DurationTag): the amount of time since the interaction. Note that this is a delta time (same limitations as Event:delta time), and may become inaccurate if the interaction entity changes worlds.
- 'raw_game_time' (ElementTag(Number)): the raw game time the interaction occurred at, used to calculate the time above.
Generated Example
- foreach <player.last_interaction> key:key as:val:
    - narrate "<[key]> is set as <[val]>"
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java#L2910
Name<InventoryTag.craftable_quantity>
ReturnsElementTag(Number)
DescriptionReturns the quantity of items that would be received if this crafting inventory were fully crafted (eg via a shift click).
Generated Example
- narrate "the number value is <player.inventory.craftable_quantity>"
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java#L2230