click
out of 3884 meta-documentation entries...Action Lines | click |
Triggers | when the NPC is clicked by a player. |
Contexts | None
|
Determine | "cancelled" to cancel the click event completely. |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/ClickTrigger.java#L68 |
Action Lines | no click trigger |
Triggers | when the NPC is clicked but no click trigger fires. |
Contexts | None
|
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/ClickTrigger.java#L57 |
Name | Clickable |
Syntax | clickable (<script>/cancel:<id>) (def:<element>|.../defmap:<map>/def.<name>:<value>) (usages:<#>) (for:<player>|...) (until:<duration>) |
Short Description | Generates a clickable command for players. |
Full Description | Generates 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 |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Group | player |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/player/ClickableCommand.java#L38 |
Name | discord button clicked |
Event Lines | discord button clicked |
Triggers | when a Discord user clicks a button. |
Generated Examples | on discord button clicked:
after discord button clicked: |
Switches | for:<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.
|
Group | Discord |
Requires | dDiscordBot |
Source | https://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/events/DiscordButtonClickedScriptEvent.java#L10 |
Name | player click_type clicks item in inventory |
Event Lines | player (<click_type>) clicks (<item>) in <inventory> |
Triggers | when a player clicks in an inventory. Note that you likely will also want to listen to player drags in inventory. |
Generated Examples | after player click_type clicks in inventory:
on player clicks in enderchest: |
Has Player | Always. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link. |
Switches | with:<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 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 Inventory Actions.
<context.hotbar_button> returns an ElementTag of the button pressed as a number, or 0 if no number button was pressed.
|
Determine | ItemTag to set the current item for the event. |
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Has Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Player |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerClicksInInventoryScriptEvent.java#L70 |
Name | player right|left clicks block |
Event Lines | player (right|left) clicks <block> |
Triggers | when a player clicks on a block or in the air. |
Generated Examples | on player left clicks waxed_cut_copper_stairs:
after player right clicks jungle_sign: |
Has Player | Always. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link. |
Switches | with:<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.
|
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Has Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Player |
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. |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerClicksBlockScriptEvent.java#L22 |
Name | player right|left clicks fake entity |
Event Lines | player (right|left) clicks fake entity |
Triggers | when a player clicks a fake entity, one that is only shown to the player and not tracked by the server. |
Generated Examples | after player clicks fake entity:
on player clicks fake entity: |
Has Player | Always. - 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 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 Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Paper |
Requires | Paper |
Source | https://github.com/DenizenScript/Denizen/blob/dev/paper/src/main/java/com/denizenscript/denizen/paper/events/PlayerClicksFakeEntityScriptEvent.java#L16 |
Name | player right clicks entity |
Event Lines | player right clicks <entity> |
Triggers | when a player right clicks on an entity. |
Generated Examples | on player right clicks item_display:
after player right clicks pufferfish: |
Has Player | Always. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link. |
Switches | with:<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.
|
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Has Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Player |
Warning(s) | this event may in some cases double-fire, requiring usage of the 'ratelimit' command (like 'ratelimit <player> 1t') to prevent doubling actions. |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerRightClicksEntityScriptEvent.java#L21 |
Name | Click Triggers |
Description | Click Triggers are triggered when a player right clicks the NPC.
These are very basic with no extraneous complexity.
They can optionally have an item matcher with multiple triggers, for the item in the player's hand. For example:
|
Group | NPC Interact Scripts |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/ClickTrigger.java#L25 |
Name | <&click[<click_command>].type[<type>]> |
Returns | ElementTag |
Description | Returns 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 Denizen Text Formatting. |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java#L84 |
Name | <&click[<click_command>]> |
Returns | ElementTag |
Description | Returns 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 Denizen Text Formatting. |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java#L67 |
Name | <&end_click> |
Returns | ElementTag |
Description | Returns a special chat code that ends a '&click' tag.
Note that this is a magic Denizen tool - refer to Denizen Text Formatting. |
Generated Example |
|
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java#L119 |
Name | <ElementTag.click_chat[<message>]> |
Returns | ElementTag |
Description | Adds a click command to the element, which makes the element pseudo-chat the input message when clicked, for activating interact script chat triggers (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 Denizen Text Formatting. |
Example |
|
Group | text manipulation |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L526 |
Name | <ElementTag.click_url[<url>]> |
Returns | ElementTag |
Description | Adds 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 Denizen Text Formatting. |
Example |
|
Group | text manipulation |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L512 |
Name | <ElementTag.on_click[<command>]> |
Returns | ElementTag |
Description | Adds 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 (Chat Triggers), you can use the command "/denizenclickable chat SOME MESSAGE HERE" (requires players have permission "denizen.clickable") For that, instead prefer ElementTag.click_chat Note that this is a magic Denizen tool - refer to Denizen Text Formatting. |
Example |
|
Example |
|
Group | text manipulation |
Source | https://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>]> |
Returns | ElementTag |
Description | Adds 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 Denizen Text Formatting. For run_command, prefer ElementTag.on_click For chat, prefer ElementTag.click_chat For URLs, prefer ElementTag.click_url |
Group | text manipulation |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L559 |
Name | player drags in inventory |
Event Lines | player drags in inventory
player drags (<item>) (in <inventory>) |
Triggers | when a player drags in an inventory (that is, clicks and then holds the mouse button down while moving the mouse across multiple slots). |
Generated Examples | after player drags in inventory:
on player drags item in furnace: on player drags glass_bottle: |
Has Player | Always. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link. |
Switches | in_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.
|
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Has Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Player |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerDragsInInvScriptEvent.java#L25 |
Name | player opens sign |
Event Lines | player opens sign |
Triggers | When a player opens a sign (eg after placing a sign, or by clicking on it to edit it). |
Generated Examples | on player opens sign:
after player opens sign: |
Has Player | Always. - 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.
|
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Has Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Paper |
Requires | Paper |
Source | https://github.com/DenizenScript/Denizen/blob/dev/paper/src/main/java/com/denizenscript/denizen/paper/events/PlayerOpenSignScriptEvent.java#L15 |
Name | discordcommand |
Related Guide Page | https://guide.denizenscript.com/guides/expanding/ddiscordbot.html |
Syntax | discordcommand (id:<bot>) [create/delete] (group:<group>) (name:<name>) (type:{slash}/user/message) (description:<description>) (options:<options>) |
Short Description | Manages Discord application commands. |
Full Description | Manages 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 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 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 discordinteraction The command should usually be ~waited for. See ~waitable. |
Related Tags | <entry[saveName].command> returns the DiscordCommandTag of a command upon creation, when the command is ~waited for.
|
Usage Example |
|
Usage Example |
|
Group | external |
Requires | dDiscordBot |
Source | https://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordCommandCommand.java#L40 |
Name | discordmessage |
Related Guide Page | https://guide.denizenscript.com/guides/expanding/ddiscordbot.html |
Syntax | discordmessage (id:<id>) [reply:<message>/edit:<message>/channel:<channel>/user:<user>] (<message>) (no_mention) (rows:<rows>) (embed:<embed>|...) (attach_files:<map>) (post_title:<name>) |
Short Description | Sends a message to a Discord channel. |
Full Description | Sends 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 DiscordButtonTag, and 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 ~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 |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Group | external |
Requires | dDiscordBot |
Source | https://github.com/DenizenScript/dDiscordBot/blob/master/src/main/java/com/denizenscript/ddiscordbot/commands/DiscordMessageCommand.java#L43 |
Name | PlaySound |
Syntax | playsound (<location>|...) (<player>|...) [sound:<name>] (volume:<#.#>) (pitch:<#.#>) (custom) (sound_category:<category_name>) |
Short Description | Plays a sound at the location or to a list of players. |
Full Description | Plays 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 server.sound_keys on MC 1.21+.
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Synonyms (Search Aid) | noise |
Group | world |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/PlaySoundCommand.java#L32 |
Name | Switch |
Syntax | switch [<location>|...] (state:{toggle}/on/off) (duration:<value>) (no_physics) |
Short Description | Switches state of the block. |
Full Description | Changes 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 |
|
Usage Example |
|
Usage Example |
|
Synonyms (Search Aid) | toggle, lever, activate, power, redstone |
Group | world |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SwitchCommand.java#L37 |
Name | Trigger |
Related Guide Page | https://guide.denizenscript.com/guides/npcs/interact-scripts.html |
Syntax | trigger [name:<trigger>] (state:{toggle}/true/false) (cooldown:<duration>) (radius:<#>) |
Short Description | Enables or disables a trigger. |
Full Description | This 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 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 |
|
Usage Example |
|
Usage Example |
|
Group | npc |
Requires | Citizens |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/npc/TriggerCommand.java#L24 |
Name | crackshot player fires projectile |
Event Lines | crackshot player fires projectile |
Triggers | just before a projectile is launched from a CrackShot weapon. |
Generated Examples | after crackshot player fires projectile:
on crackshot player fires projectile: |
Has Player | Always - 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 |
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Group | Depenizen |
Requires | Depenizen, CrackShot |
Source | https://github.com/DenizenScript/Depenizen/blob/master/src/main/java/com/denizenscript/depenizen/bukkit/events/crackshot/CrackShotPlayerFiresProjectileEvent.java#L19 |
Name | player crafts item |
Event Lines | player crafts item
player crafts <item> |
Triggers | when a player fully crafts an item. |
Generated Examples | after player crafts item: |
Has Player | Always. - 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
|
Determine | ItemTag to change the item that is crafted. |
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Group | Player |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerCraftsItemScriptEvent.java#L25 |
Name | player empties bucket |
Event Lines | player empties bucket
player empties <item> |
Triggers | when a player empties a bucket. |
Generated Examples | on player empties bucket:
after player empties item: after player empties grindstone: |
Has Player | Always. - 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.
|
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Has Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Player |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerEmptiesBucketScriptEvent.java#L17 |
Name | player fills bucket |
Event Lines | player fills bucket
player fills <item> |
Triggers | when a player fills a bucket. |
Generated Examples | after player fills bucket:
after player fills blackstone_stairs: on player fills bucket: after player fills diorite_wall: |
Has Player | Always. - 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.
|
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Has Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Player |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerFillsBucketScriptEvent.java#L17 |
Name | player uses recipe book |
Event Lines | player uses recipe book |
Triggers | when a player interacts with their recipe book. |
Generated Examples | on player uses recipe book: |
Has Player | Always. - 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'.
|
Cancellable | True - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false' |
Has Location | True - This adds the switches 'in:<area>', 'location_flagged:<flag>', ... |
Group | Paper |
Requires | Paper |
Source | https://github.com/DenizenScript/Denizen/blob/dev/paper/src/main/java/com/denizenscript/denizen/paper/events/PlayerClicksInRecipeBookScriptEvent.java#L14 |
Name | Advanced Object Matchables |
Description | Script 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 LocationTag and 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 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 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. |
Group | Object System |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/BukkitScriptEvent.java#L45 |
Name | Chat Triggers |
Description | Chat 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:
|
Group | NPC Interact Scripts |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/ChatTrigger.java#L40 |
Name | Damage Triggers |
Description | Damage 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. |
Group | NPC Interact Scripts |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/triggers/core/DamageTrigger.java#L30 |
Name | Denizen Permissions |
Description | The following is a list of all permission nodes Denizen uses within Bukkit.
denizen.clickable # use the 'denizenclickable' command, which is automatically executed when using 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>" ) |
Group | Console Commands |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/utilities/command/DenizenCommandHandler.java#L30 |
Name | Denizen Text Formatting |
Description | Denizen 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. |
Group | Denizen Magic |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/utilities/FormattedTextHelper.java#L22 |
Name | Health Trait |
Description | By 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 EntityTag.health EntityTag.formatted_health EntityTag.health_max EntityTag.health_percentage NPCTag.has_trait[health] Related Mechanisms EntityTag.health EntityTag.max_health Related Commands heal health vulnerable Related Actions on damage on damaged on no damage trigger |
Group | NPC Traits |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/npc/traits/HealthTrait.java#L29 |
Name | Interact Script Containers |
Description | Interact script containers are used to handle NPC triggers.
Interact scripts must be referenced from an assignment script container to be of any use. See 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: zap. Each step contains a list of trigger types that it handles, and the relevant handling that the given trigger makes available. Refer to interact script triggers for documentation about the triggers available. Any triggers used must be enabled in assignment by 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).
|
Group | Script Container System |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/containers/core/InteractScriptContainer.java#L19 |
Name | Interact Script Triggers |
Description | Interact 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 cooldown or engage. Triggers go in interact script containers. The available default trigger types are click triggers, damage triggers, chat triggers, and proximity triggers. |
Group | NPC Interact Scripts |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/containers/core/InteractScriptContainer.java#L67 |
Name | Inventory Actions |
Description | Used 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. |
Group | Useful Lists |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/player/PlayerClicksInInventoryScriptEvent.java#L20 |
Name | Inventory Script Containers |
Description | Inventory 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.
|
Group | Script Container System |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/containers/core/InventoryScriptContainer.java#L26 |
Name | Safety In Events |
Description | One 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:
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".
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 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.
|
Group | Script Events |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/events/BukkitScriptEvent.java#L934 |
Name | max_stack_size |
Object | MaterialTag |
Input | ElementTag(Number) |
Related Tags | <MaterialTag.max_stack_size> Returns the maximum amount of this material that can be held in a stack.
|
Description | Sets 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 |
|
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/MaterialTag.java#L742 |
Name | TradeTag |
Prefix | trade@ |
Base Type | ElementTag |
Implements | PropertyHolderObject |
Identity Format | The identity format for trades is just the text 'trade'. All other data is specified through properties. |
Description | Merchant 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.
|
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/TradeTag.java#L17 |
Name | <&insertion[<message>]> |
Returns | ElementTag |
Description | Returns 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 Denizen Text Formatting. |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/tags/core/TextTagBase.java#L102 |
Name | <ElementTag.strip_color> |
Returns | ElementTag |
Description | Returns 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 |
|
Group | text manipulation |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L346 |
Name | <ElementTag.with_insertion[<message>]> |
Returns | ElementTag |
Description | Adds 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 Denizen Text Formatting. |
Group | text manipulation |
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/properties/bukkit/BukkitElementExtensions.java#L580 |
Name | <EntityTag.last_interaction> |
Returns | MapTag |
Description | Returns 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 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 |
|
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/EntityTag.java#L2910 |
Name | <InventoryTag.craftable_quantity> |
Returns | ElementTag(Number) |
Description | Returns the quantity of items that would be received if this crafting inventory were fully crafted (eg via a shift click). |
Generated Example |
|
Source | https://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/objects/InventoryTag.java#L2230 |