Leaf Essentials Wiki
  • Discord
  • Contribute
  • MCBETools
  • Github
  • Home
  • Installation
  • More Projects
  • More Resources
  • Server List
Chat
  • Channels
  • Ranks Configuration
    • Legacy Ranks
      deprecated
    • Managing Ranks
  • Chat Widgets
    • Introduction to Chat Widgets
  • Chat Rank Formats
    • Introduction to Chat Formats
Customizer
  • Basics
    • Creating UIs
    • About Buttons
    • Formatting
  • Advanced
    • /leaf:render_as
      advanced
    • How to Use conditions
      advanced
    • How to Use invites
      advanced
  • Miscellaneous
    • Button Meta
      info
  • Essentials
    • Opening builtin Leaf UIs
  • Extensions
    • Button Meta Hooks
FAQ
  • FAQ - General
  • Leaf Not Working on Realms
  • Plant Kitty
Misc Features
  • World Utilities
    • Binds
    • Block Property Editor
    • Entity Property Editor
    • Zones (Old Docs)
Moderation Hub
  • Bans
Script API
  • Basics
    • Hooks
Slash Commands
  • Utilities
    • /trigger & /on
    • Inventory Saving
    • Leaf Tell
    • Persistent Points
    • Server Transferring
    • Teams
    • Weighted RNG
    • World Tags
Zones
  • Zones - Basics
  • Zones - Triggers

Inventory Saving

Inventory Saving
  • Saving/Loading
  • Global and Player inventories
  • Use cases

Saving/Loading ​

To save a players inventory, you can do either of these:

/leaf:save_inv_player <player> <name>
/leaf:save_inv_global <player> <name>
1
2

For loading, you can do:

/leaf:load_inv_player <player> <name>
/leaf:load_inv_global <player> <name>
1
2

examples:

/leaf:save_inv_player TrashyDaFox inventory1
/leaf:save_inv_player @a kitpvp
/leaf:load_inv_global @a[r=10] meow
1
2
3

Global and Player inventories ​

Global will save the inventory to a global name, while player is separated per player

They will be saved separately, so you can have a global inventory with the same name as some players inventory, so you cant have mismatched player/global saving/loading

Use cases ​

With Zones you can have On Enter & On Exit commands to give the illusion of separate inventories per area

This is the way I do the zones :3

On Enter:
/leaf:save_inv_player @s old
/leaf:load_inv_player @s new

On Exit:
/leaf:save_inv_player @s new
/leaf:load_inv_player @s old
1
2
3
4
5
6
7

this can be expanded on if you need multiple zones with different inventories :3

Note: /clear will NOT work in succession to saving; due to MC limitations, lots of leaf commands have to wait for the next tick, so /clear will run faster. Inventory loading will by default clear the inventory, so just use that to clear

Contributors

Edit Inventory Saving on GitHub