command /magazyn []: trigger: set {_strony} to rounded up size of {magazyn::%player%::items::*} / 54 clear {magazyn::%player%::items::0} if arg 1 is between 1 and {_strony}: open chest with 6 rows named "&6Magazyn &8(&7%arg 1%&8)" to player wait 2 tick set {_num} to size of {magazyn::%player%::items::*} set {_max} to arg 1 * 53 set {_min} to {_max} - 52 if (arg 1 + 1) is smaller than or equal to {_strony}: set player's current inventory's slot 53 to paper named "&6Nastepna strona." set {_i} to 0 set {_k} to 1 loop {magazyn::%player%::items::*}: if {_k} is between {_min} and {_max}: if {_k} <= {_num}: send "%loop-index% -> %loop-value%" set {_item} to "%loop-index%" parsed as item type set player's current inventory's slot {_i} to {_item} with lore "%loop-value%" add 1 to {_i} add 1 to {_k} stop send "&c* &6Masz pusty magazyn!" stop on inventory click: if "%uncoloured inventory name of player's current inventory%" contains "Magazyn": if slot is smaller than 0: stop cancel event if player's current inventory's slot slot is paper: if name of player's current inventory's slot slot is "&6Nastepna strona.": set {_strona} to "%uncoloured inventory name of player's current inventory%" replace all "Magazyn (" in {_strona} with "" replace all ")" in {_strona} with "" set {_strona} to {_strona} parsed as integer close player's inventory wait 2 tick execute player command "magazyn %{_strona} + 1%" stop set {_lore::*} to lore of player's current inventory's slot slot split at "||" set {_amount} to "%uncoloured {_lore::2}%" parsed as integer set {_first} to "%uncoloured {_lore::2}%" parsed as integer set {_item} to id of player's current inventory's slot slot set {_i} to "%{_amount}% %{_item}%" parsed as item type send "%{_i}% %{_amount}% %{_item}%" if player has enough space for {_i}: give {_i} to player clear {magazyn::%player%::items::%{_item}%} send "&6Dostales &c%{_i}% &6z magazynu." close player's inventory stop loop {_amount} times: remove 1 from {_amount} set {_i} to "%{_amount}% %{_item}%" parsed as item type if player has enough space for {_i}: give {_i} to player send "&6Dostales &c%{_i}% &6z magazynu." set {magazyn::%player%::items::%{_item}%} to "&6Ilosc:||&a%{_first} - {_amount}%" close player's inventory exit loop stop on rightclick: if player's tool is not air: if targeted block is set: stop if player has permission "vip.mag": if {magazyn::%player%::item} is player's tool: loop {magazyn::%player%::items::*}: if "%loop-index%" is "%id of tool of player%": send "Jest" set {_lore::*} to loop-value split at "||" set {_amount} to "%uncoloured {_lore::2}%" parsed as integer clear {_lore::*} add amount of tool of player to {_amount} set {magazyn::%player%::items::%loop-index%} to "&6Ilosc:||&a%{_amount}%" send "&6Pomyslnie dodales: &c%amount of tool of player% %type of tool of player%" clear {magazyn::%player%::item} if {_amount} is set: remove "%amount of tool of player% %type of tool of player%" parsed as item type from player stop set {magazyn::%player%::items::%id of tool of player%} to "&6Ilosc:||&a%amount of tool of player%" remove "%amount of tool of player% %type of tool of player%" parsed as item type from player stop set {magazyn::%player%::item} to player's tool send "&6Kliknij jeszcze raz, by dodac: &c%amount of tool of player% %type of tool of player%" stop