options: refile-limit: 7 koxy-limit: 5 perly-limit: 11 # Schowek Limity schowek-name: &9Schowek refile-schowek: 12 koxy-schowek: 6 perly-schowek: 16 function setVariables(Player: Player): set {schowek::refile::%{_Player}%} to 0 if {schowek::refile::%{_Player}%} is not set set {schowek::koxy::%{_Player}%} to 0 if {schowek::koxy::%{_Player}%} is not set set {schowek::perly::%{_Player}%} to 0 if {schowek::perly::%{_Player}%} is not set function CheckItems(Player: Player): while {_Player} is online: wait 12 ticks while {_Player} have {@refile-limit} +1 of golden apple: wait 1 tick if {schowek::refile::%{_Player}%} > {@refile-schowek}: remove 1 golden apple from {_Player} drop golden apple at {_Player} wait 1 tick else: remove 1 golden apple from {_Player} add 1 to {schowek::refile::%{_Player}%} while {_Player} have {@koxy-limit} +1 of enchanted golden apple: wait 1 tick if {schowek::koxy::%{_Player}%} > {@koxy-schowek}: remove 1 enchanted golden apple from {_Player} drop enchanted golden apple at {_Player} wait 1 tick else: remove 1 enchanted golden apple from {_Player} add 1 to {schowek::koxy::%{_Player}%} while {_Player} have {@perly-limit} +1 of ender pearl: wait 1 tick if {schowek::perly::%{_Player}%} > {@perly-schowek}: remove 1 ender pearl from {_Player} drop ender pearl at {_Player} wait 1 tick else: remove 1 ender pearl from {_Player} add 1 to {schowek::perly::%{_Player}%} function SchowekGui(Player: Player) :: inventory: set {_Schowek} to chest inventory named "{@schowek-name}" with 1 rows set slot (integers between 0 and 9) of {_Schowek} to gray stained glass pane set slot 2 of {_Schowek} to golden apple named "&eRefile: %{schowek::refile::%{_Player}%}%" with lore "- &2Lewy Przycisk, Aby Wypłacić", "- &2Prawy Aby Wpłacić" set slot 4 of {_Schowek} to enchanted golden apple named "&6Koxy: %{schowek::koxy::%{_Player}%}%" with lore "- &2Lewy Przycisk, Aby Wypłacić", "- &2Prawy Aby Wpłacić" set slot 6 of {_Schowek} to ender pearl named "&dPerly: %{schowek::perly::%{_Player}%}%" with lore "- &2Lewy Przycisk, Aby Wypłacić", "- &2Prawy Aby Wpłacić" return {_Schowek} function ConfigureLimits(Player: Player, item: item) :: boolean: if {_item} is enchanted golden apple: if {schowek::koxy::%{_Player}%} > {@koxy-schowek}: set {_limit} to {@koxy-limit} -1 {_Player} have {_limit} of enchanted golden apple return false if {_item} is golden apple: if {schowek::refile::%{_Player}%} > {@refile-schowek}: {_Player} have {@refile-limit} of golden apple return false if {_item} is enchanted golden apple: if {schowek::perly::%{_Player}%} > {@perly-schowek}: set {_limit} to {@perly-limit} -1 {_Player} have {_limit} of ender pearl return false function GuiSystem(Player: Player, slot: string, type: click type, inv: inventory): if "%{_slot}%" contains "notch apple": if "%{_type}%" is "left mouse button": if {_Player} doesn't have {@koxy-limit} of enchanted golden apple: wait 1 tick if {schowek::koxy::%{_Player}%} > 0: add enchanted golden apple to {_Player} remove 1 from {schowek::koxy::%{_Player}%} set slot 4 of {_inv} to enchanted golden apple named "&6Koxy: %{schowek::koxy::%{_Player}%}%" with lore "- &2Lewy Przycisk, Aby Wypłacić" if "%{_slot}%" contains "golden apple": if "%{_type}%" is "left mouse button": if {_Player} doesn't have {@refile-limit} of golden apple: wait 1 tick if {schowek::refile::%{_Player}%} > 0: add golden apple to {_Player} remove 1 from {schowek::refile::%{_Player}%} set slot 2 of {_inv} to golden apple named "&eRefile: %{schowek::refile::%{_Player}%}%" with lore "- &2Lewy Przycisk, Aby Wypłacić" if "%{_slot}%" contains "ender pearl": if "%{_type}%" is "left mouse button": if {_Player} doesn't have {@perly-limit} of ender pearl: wait 1 tick if {schowek::perly::%{_Player}%} > 0: add ender pearl to {_Player} remove 1 from {schowek::perly::%{_Player}%} set slot 6 of {_inv} to ender pearl named "&dPerly: %{schowek::perly::%{_Player}%}%" with lore "- &2Lewy Przycisk, Aby Wypłacić" on join: setVariables(Player) CheckItems(Player) command /schowek []: trigger: open SchowekGui(Player) to player on pickup of golden apple or enchanted golden apple or ender pearl: if ConfigureLimits(Player, event-item) is false: cancel event on inventory click: current inventory is not player's inventory if name of event-inventory is "{@schowek-name}": cancel event set {_slot} to "%clicked slot%" set {_type} to click type set {_inv} to event-inventory GuiSystem(Player, {_slot}, {_type}, {_inv})