Denizen Script Commands


Commands are always written with a '-' before them, and are the core component of any script, the primary way to cause things to happen.
Learn about how commands work in The Beginner's Guide.


Showing 1 out of 183 commands...
NameInventory
Syntaxinventory [open/close/copy/move/swap/set/keep/exclude/fill/clear/update/adjust <mechanism>:<value>/flag <name>(:<action>)[:<value>] (expire:<time>)] (destination:<inventory>) (origin:<inventory>/<item>|...) (slot:<slot>)
Short DescriptionEdits the inventory of a player, NPC, or chest.
Full DescriptionUse this command to edit the state of inventories.
By default, the destination inventory is the current attached player's inventory.

If you are copying, swapping, removing from (including via "keep" and "exclude"), adding to, moving, or filling inventories,
you'll need both destination and origin inventories.

Origin inventories may be specified as a list of ItemTags, but destinations must be actual InventoryTags.

Using "open", "clear", or "update" only require a destination.
"Update" also requires the destination to be a valid player inventory.

Using "close" closes any inventory that the currently attached player has opened.

The "adjust" option adjusts mechanisms on an item within a specific slot of an inventory (the "slot" parameter is required).
Note that this is only for items, it does NOT adjust the inventory itself. Use Command:adjust to adjust an inventory mechanism.

The "flag" option sets a flag on items, similar to Command:flag.
See also Language:flag system.

The "update" option will refresh the client's view of an inventory to match the server's view, which is useful to workaround some sync bugs.

Note that to add items to an inventory, you should usually use Command:give,
and to remove items from an inventory, you should usually use Command:take.

The slot argument can be any valid slot, see Language:Slot Inputs.
Related Tags<PlayerTag.inventory> Returns a InventoryTag of the player's current inventory. (...)
<PlayerTag.enderchest> Gets the player's enderchest inventory. (...)
<PlayerTag.open_inventory> Gets the inventory the player currently has open. If the player has no open (...)
<NPCTag.inventory> Returns the InventoryTag of the NPC.
<LocationTag.inventory> Returns the InventoryTag of the block at the location. If the (...)
Usage Example
#Use to open a chest inventory, at a location.
- inventory open d:<context.location>
Usage Example
#Use to open a virtual inventory with a title and some items.
- inventory open d:generic[size=27;title=BestInventory;contents=snowball|stick]
Usage Example
#Use to open another player's inventory.
- inventory open d:<[player].inventory>
Usage Example
#Use to remove all items from a chest, except any items in the specified list.
- inventory keep d:<context.location.inventory> o:snowball|ItemScript
Usage Example
#Use to remove all sticks and stones from the player's inventory.
- inventory exclude origin:stick|stone
Usage Example
#Use to clear the player's inventory entirely.
- inventory clear
Usage Example
#Use to swap two players' inventories.
- inventory swap d:<[playerOne].inventory> o:<[playerTwo].inventory>
Usage Example
#Use to adjust a specific item in the player's inventory.
- inventory adjust slot:5 "lore:Item modified!"
Usage Example
#Use to set a single stick into slot 10 of the player's inventory.
- inventory set o:stick slot:10
Usage Example
#Use to set a temporary flag on the player's held item.
- inventory flag slot:hand my_target:<player.cursor_on> expire:1d
Groupitem
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/item/InventoryCommand.java#L87