[Skript Help] Restore items on respawn if condition is met

Discussion in 'Spigot Plugin Help' started by Gerlif, May 6, 2017.

  1. Hey, so I'm trying to write a Skript that saves player inventories on death, but only if the player has a certain item in their inventory when dying.

    How do I check if player drops contain a certain item? So far I've tried this, but its not working.

    Code (Text):

    on death of player:
        if player has permission "admin.admin":
            set {deathdrops.%uuid of victim%::*} to drops
            if {deathdrops.%uuid of victim%::*} contains 1 bedrock:
                set {voidcrystalused.%uuid of player%} to true
                message "Inventory saved"
                clear drops

    on respawn:
        if player has permission "admin.admin":
            if {voidcrystalused.%uuid of player%} is true:
                add {deathdrops.%uuid of player%::*} to player's inventory
                message "Inventory added"
                set {voidcrystalused.%uuid of player%} to false