Coś takiego u mnie działa:
on script load:
set {kozak::replace::1} to "leather"
set {kozak::replace::2} to "iron"
set {kozak::replace::3} to "diamond"
set {kozak::replace::4} to "gold"
set {kozak::replace::5} to "netherite"
on inventory click:
set {_cb} to index of clicked slot
set {_i} to clicked slot
lepsze(player, {_cb}, {_i})
function lepsze(p:player, nr:number, i:item):
if {_i} is any helmet or any chestplate or any leggings or any boots:
loop {kozak::replace::*}:
if "%{_i}%" contains loop-value:
set {_add} to (loop-index parsed as integer) + 1
if {kozak::replace::%{_add}%} is not set:
stop
exit loop
if {_add} is not set:
stop
set {_type} to "%type of {_i}%"
replace all {kozak::replace::%{_add}-1%} with {kozak::replace::%{_add}%} in {_type}
set {_type} to {_type} parsed as item type
set {_ench::*} to {_i}'s enchantments
broadcast "%{_ench::*}%"
set {_name} to {_i}'s name
set {_lore::*} to {_i}'s lore
if {_name} is set:
set name of {_type} to {_name}
if {_ench::*} is set:
enchant {_type} with {_ench::*}
if {_lore::*} is set:
add {_lore::*} to lore of {_type}
set slot {_nr} of {_p}'s inventory to {_type}