manage_inventory
Is an action that allows you to save, open and delete the different inventories to the players.
Meaning
Allows you to save, open and delete the different inventories to the players (you can save and delete any inventories, but open only suitable of them for players).
Format
- 'manage_inventory: action:<action>;<option>:<value>;<optionN>:<valueN>'
action:<action> – may be save, open or delete, you can add "?" symbol before the action to use the temporary inventories storage, that is, until server restart; (MANDATORY)
Options (any order):
inventory:<inventory_id> – indicates by which id/name the inventory will be used (can be skipped only in case of "open" action); (SEMI-MANDATORY)
fake:<true | false> – whether to open the fake inventory or not in cases of anvil, workbench and so on inventories (use only in case of "open" action, can be skipped); (SEMI-OPTIONAL)
owner:<entity_uuid | player_name | world,x,y,z> – indicates which inventory will be used (for example of some player), if specified, all other properties will be ignored, you also can use "^" before the nickname to use the open player's inventory and "|<slot (indices or named slots)>" after to get inventory of the some item (for example, shulker box) (use only in case of "save" or "open" actions, can be skipped); (SEMI-OPTIONAL)
holder:<entity_uuid | player_name | world,x,y,z> – the holder which will hold the inventory (use only in case of "save" or "open" actions, can be skipped); (SEMI-OPTIONAL)
target:<player> – for which player the inventory will be opened (use only in case of "open" action); (SEMI-MANDATORY)
typeOrSize:<inventory_type | integer_size> – the type or the size of the inventory, see the available types here, in case of size it should be a multiple of 9 between 9 and 54 slots, for example, 18 (use only in case of "save" or "open" actions); (SEMI-MANDATORY)
title:<inventory_title> – the title of the inventory (use only in case of "open" action, can be skipped). (SEMI-OPTIONAL)
The perpetual inventories and temporary inventories are different! The same inventories names will point to different inventories.
If you want to open plyer's inventory with armor contents, you firstly need to save it, then open the saved inventory.
You can not create the "CREATIVE", "CRAFTING" and "MERCHANT" inventory types, only if specified <owner> will be merchant inventory, you can open it, but not save. You can specify the <owner> option and saving or opening inventories of this owner, without necessity to specify the inventory options like <holder>, <typeOrSize> and <title>. You can save and open any block inventories but only InventoryHolders of them will be saving their contents. Not all mobs inventories are suitable for opening to the players due to their incompatible size. You can specify or <inventory> option to open/resave/delete the saved inventory, or <owner> option to open/save the someone's inventory, or <holder>, <typeOrSize> and <title> options to create and open/save the new inventory depends on these values.
If "?" prefix will not be specified in the action, the inventory will be stored in a file at the path plugins/TriggerReactor/inventories.json (you can change this file, changes will take effect after the command /trg reload confirm), otherwise the inventory will be stored in the server memory until it is restarted.
Targets
Entities (InventoryHolders);
Players;
Storages (InventoryHolders).
Where is useful
For example, if you need to create the custom system of "virtual personal storages", it also can be combined in a useful way with change_item action for "expandable storages" etc.
Examples
- 'manage_inventory: action:open;target:%player%;holder:%player%;typeOrSize:CHEST;title:§fMy little inventory' # Open the new inventory to the current player with type "CHEST", title "§fMy little inventory" and holder as the current player
- 'manage_inventory: action:save;inventory:%player% Enderchest;owner:^%player%;title:§aSaved Enderchest' # Save the open inventory (for example, enderchest) of the current player with custom title
- 'manage_inventory: action:open;owner:world,3097,65,8607|0;target:%player%' # Open the inventory of the item (for example, of the shulker box) in the block (for example, in the chest) at the specified location to the current player