Inventory Restoration

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Sovde

Staff member
Moderator
Feb 18, 2022
21
2
3
Inventory Backups

**Requires: SkBee (tested on 2.8.2+, should work on 2.5.0+), skript-gui 1.3+**

You can view the source code at the github page: https://github.com/sovdeeth/skript-systems/tree/main/inventory-backup

This script automatically saves a backup of a player's inventory when they die. By default it stores deaths for 30 days, but can be configured to whatever you want. The backups are stored in NBT files, which by default are in "plugins/inventory-backups/" but can also be changed through the options.

The script mainly runs through a GUI accessible through "/invrestore <player>". This will show you a history of their backups, starting from most recent, with 5 shown per page. You can do multiple actions by clicking on these backups in various ways.

View attachment 7479

A left click will open the backup to you, showing all their items and allowing you to pull specific items out or add items in. These changes do not affect the backup until you click the "save edits" button. This screen will also show individual buttons for the other actions.

Right clicking will give the backup to the player without clearing their current inventory. If their inventory is full, the rest of the items will drop on the ground at the player. If you wish to clear their existing items, you can shift-click on the restore button when viewing the backup.

Shift-left-clicking will teleport you to the location that the player died.

Shift-right-clicking will delete the backup. Be careful.

Some examples and images:
Viewing a backup:
View attachment 7478
Shift-click in this view to clear the player's inventory before restoring the backup.
View attachment 7480