Files
midas_hand.sk
Code
1 59
midas_hand.sk
# Ręka Midasa - GUI System
# Zamienia przedmioty w złoto lub diamenty
options:
prefix: &6[Midas]&r
gui-name: &6&lMagiczna Ręka Midasa
item-name: &3ręka Midasa
command /midas:
permission: midas.use
permission message: &cNie masz uprawnień do użycia tej komendy!
trigger:
open virtual chest inventory with size 3 named "{@gui-name}" to player
wait 1 tick
set slot 13 of player's current inventory to stick named "{@item-name}" with lore "&7Lewy przycisk: &e&lZŁOTO", "&7Prawy przycisk: &b&lDIAMENTY", "", "&6Kliknij aby przemienić swoje przedmioty!"
on inventory click:
if name of event-inventory contains "Magiczna Ręka Midasa":
cancel event
if name of clicked item is "{@item-name}":
if click type is left mouse button:
close player's inventory
set {_count} to 0
loop all items in player's inventory:
if loop-item is set:
if loop-item is not air:
set {_amount} to amount of loop-item
remove loop-item from player's inventory
give {_amount} of gold ingot to player
add 1 to {_count}
play sound "entity.player.levelup" with volume 1 and pitch 1.5 to player
send "{@prefix} &ePrzemieniono &6%{_count}%&e typów przedmiotów na &6&lZŁOTO&e!" to player
create a safe explosion of force 0 at player
else if click type is right mouse button:
close player's inventory
set {_count} to 0
loop all items in player's inventory:
if loop-item is set:
if loop-item is not air:
set {_amount} to amount of loop-item
remove loop-item from player's inventory
give {_amount} of diamond to player
add 1 to {_count}
play sound "entity.player.levelup" with volume 1 and pitch 2 to player
send "{@prefix} &bPrzemieniono &3%{_count}%&b typów przedmiotów na &b&lDIAMENTY&b!" to player
create a safe explosion of force 0 at player
on inventory close:
if name of event-inventory contains "Magiczna Ręka Midasa":
wait 1 tick
if player's current inventory is not event-inventory:
send "{@prefix} &eZamknięto magiczne GUI." to player