manage_inventory

Quite a multifunctional action that allows you to manage (save, open, set, add, clear and delete) different inventories to the players, blocks, entities etc.


Meaning

Allows you to manage (save, open, set, add, clear and delete) different inventories to the players, blocks, entities etc. You can, for example, save inventory of some entity, open inventory of some player, set inventory of some block from the saved entity's inventory or current player's inventory and many more.


Format
- 'manage_inventory: action:<action>;<option>:<value>;<optionN>:<valueN>'

action:<action> โ€“ may be save, open, set, add, clear or delete, "save" will save the inventory from some owner or newly created with possible further opening or deletion, "open" will open the inventory to the target from some owner, from some saved inventory or newly created, "set" and "add" will set/add the inventory to the target from some owner or from some saved inventory, "clear" will clear the inventory to the target and "delete" will delete the specified saved inventory, also "set" and "clear" can set and reset title for the opened player's inventory if only title and target are specified, you can add "?" symbol before the action to use the temporary inventories storage, that is, until server restart (see more info about "?" in the hints); (MANDATORY)

Options (any order (you do not need to specify "inventory", "owner" and "typeOrSize" together, despite the fact that they are "semi-mandatory", you only need one of them, otherwise the action will not be executed)):

inventory:<inventory_id> โ€“ indicates by which id/name the inventory will be saved, opened or deleted, any text is supported (use only in case of "save", "open" and "delete" actions) (see more info in the hints); (SEMI-MANDATORY)

fake:<true | (default)false> โ€“ in case of functional inventories of blocks like anvils, workbenches etc indicates whether the real functionality of the inventory will persist (fake:false) or not (fake:true) and whether the holder by default will exist (fake:false) or not (fake:true), in case of any other inventories indicates whether the content of this inventory will be used (fake:false) or not (fake:true) and whether the holder by default will exist (fake:false) or not (fake:true) (use only in case of "save" or "open" actions, can be skipped) (see more info in the hints); (SEMI-OPTIONAL)

owner:<entity_uuid | player_name | world,x,y,z> โ€“ indicates whose inventory will be used (for example of some player), you also can use "^" before the nickname to use the open player's inventory and "|<slot (index or named slot)>" after to get inventory of the some item (for example, shulker box in inventory) (use only in case of "save", "open", "set" and "add" actions) (see more info in the hints); (SEMI-MANDATORY)

holder:<entity_uuid | player_name | world,x,y,z> โ€“ the holder which will hold the inventory, you can not specify custom holder if "fake:false" is specified, only in case of "fake:true" or opening some saved inventory (does not matter "fake:false" or "fake:true" - it is still a copy) you can specify custom holder, in any case the holder should be an InventoryHolder (use only in case of "save" or "open" actions, can be skipped) (see more info in the hints); (SEMI-OPTIONAL)

target:<player> โ€“ for which player the inventory will be opened or changed, in case of "set", "add" and "clear" actions you can use here the same "^" and "|<slot (index or named slot)>" as well (use only in case of "open", "set", "add" and "clear" actions) (see more info in the hints); (SEMI-MANDATORY)

typeOrSize:<inventory_type | integer_size> โ€“ you can save or open newly created inventory, for that specify the type or the size of the inventory here, 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" and "open" actions) (see more info in the hints); (SEMI-MANDATORY)

title:<inventory_title> โ€“ the title of the inventory, you can not specify custom title for opening if "fake:false" is specified, only in case of "fake:true" for opening, saving (does not matter "fake:false" or "fake:true" - it is a copy) or opening some saved inventory (again does not matter "fake:false" or "fake:true" - it is still a copy) you can specify custom title, you can also just use "set" or "clear" action and specify only "target" with custom title, this will set or reset title in inventory if the target is player with some opened inventory, if no title is specified, the inventory will try to be used with its basic minecraft title (use only in case of "save", "open", "set" or "clear" actions, can be skipped) (see more info in the hints). (SEMI-OPTIONAL)


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 as well), otherwise the inventory will be stored in the server memory until it is restarted.


Targets

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. Or, for example, if you need to create some kind of inventories managing system (to see them, change and more) like /invsee command in Essentials etc. Or after all if you want to implement your own inventories backupping system to backup players inventories on different occasions and then be able to restore them. And many more.


Examples
- 'manage_inventory: action:open;target:%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 (because by default it is fake:false and holder always exist)
- 'manage_inventory: action:save;inventory:Open inventory of %player%;owner:^%player%;title:ยงa%player% saved opened inventory' # Save the opened inventory (for example, some merchant or chest) 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
- 'manage_inventory: action:set;inventory:specialSavedInv;target:2b3d2f25-5747-495b-82c0-a6138e4b0a44' # Set the saved inventory to some entity
- 'manage_inventory: action:set;title:Custom Title;target:%player%' # Set custom title to the opened inventory of some player

Last updated