command /zapisz [<text>]:
trigger:
if player's inventory is empty:
send "&cTwój ekwipunek jest pusty!"
stop
if arg is not set:
send "&cPodaj nazwę ekwipunku!"
stop
if {saveInv::%player%::%arg%} is set:
send "&cTa nazwa jest już zajęta!"
stop
set {saveInv::%player%::%arg%} to arg
set {saveInv::%player%::%arg%::date} to now
set {_s} to 0
loop 41 times:
if slot {_s} of player is not empty:
set {saveInv::%player%::%arg%::items::%{_s}%} to slot {_s} of player
add 1 to {_s}
clear player's inventory
send "&eTwój ekwipunek z nazwą &9%arg% &ezostał zapisany dnia &9%{saveInv::%player%::%arg%::date}%"
send "&7Zapisanych przedmiotów: &9%size of {saveInv::%player%::%arg%::items::*}%"
command /przywroc [<text>]:
trigger:
set {_inv} to chest inventory with 1 row named "&aZapisane ekwipunki"
set {_s} to 0
loop {saveInv::%player%::*}:
set slot {_s} of {_inv} to chest named "&c%loop-index%" with lore "&eData zapisu: &9%{saveInv::%player%::%loop-index%::date}%" and "&eZapisanych przedmiotów: &9%size of {saveInv::%player%::%loop-index%::items::*}%" and "&ePrzedmioty:"
loop {saveInv::%player%::%loop-index%::items::*}:
add " &e- &9%loop-value-2%" to lore of slot {_s} of {_inv}
add 1 to {_s}
open {_inv} to player
on inventory click:
if name of event-inventory is "&aZapisane ekwipunki":
cancel event
if clicked inventory is player's inventory:
stop
if type of clicked slot is not chest:
stop
if player's inventory is not empty:
send "&cTwój ekwipunek musi być pusty!"
stop
set {_id} to uncolored name of clicked slot
loop {saveInv::%player%::%{_id}%::items::*}:
set {_s} to loop-index parsed as integer
set {_i} to loop-value
set slot {_s} of player to {_i}
close player's inventory
send "&eEkwipunek z dnia &9%{saveInv::%player%::%{_id}%::date}% &ezostał przywrócony."
clear {saveInv::%player%::%{_id}%::*} and {saveInv::%player%::%{_id}%}