Options: prefix: rynek: "&7[&aRynek&7] &r" function searchGUI(player: player, search: text, page: number, inputText: boolean, sort: text): if {_page} is not set: set {_page} to 1 if {_inputText} is true: set {_itemki.%{_player}'s name%::*} to slot (integers from 0 to 35) of {_player} loop {_itemki.%{_player}'s name%::*}: if "%loop-value%" is not "air": add loop-value to {itemki.%{_player}'s name%::*} send "%{itemki.%{_player}'s name%::*}%" to {_player} set slot (integers between 0 and 35) of {_player} to air set {_gui} to a new anvil gui named "&6Rynek Szukaj:" with default text "Wpisz tutaj..." set left item of {_gui} to iron shovel named "Reset" with lore "&aKliknij, Aby zresetować" and "&akryteria wyszukiwania!" set right item of {_gui} to iron shovel named "" set output item of {_gui} to iron shovel named "Reset" open anvil gui {_gui} to {_player} set slot 8 of {_player} to hopper named "&6Filtr szukania: %{_sort}%" with lore {_lore::*} set slot 4 of {_player} to oak door named "&7Wróc na Rynek " with lore "&8» &7Jeżeli nie widzisz w wyszukiwaniu" and "&7przedmiotu którego szukasz" and "&7możesz powrócić na rynek" and "" and "&6Strona: &f%{_page}%&7/&f%{_max}%" else : if type of {_player}'s current inventory is anvil inventory named "&6Rynek Szukaj:": set {_strona} to {_page} set {_max} to floor((size of {Rynek::*}/26)-0.001)+1 if {_max} is 0: set {_brak} to true set {_max} to 1 set {_strona} to 1 if {_strona} <= 1: set {_strona} to 1 set {_prev} to true if {_strona} >= {_max}: set {_strona} to {_max} set {_next} to true set slots (integers between 0 and 8) of {_player} to gray stained glass pane named "&k&7&l &k" if {_prev} is not set: set slot 3 of {_player} to arrow named "&aPoprzednia strona" if {_next} is not set: set slot 5 of {_player} to arrow named "&aNastepna strona" set {_c} to 9 set slot (integers between 9 and 36) of {_player}'s inventory to air loop {Rynek::*}: set {_NewList::%loop-value%.%loop-index%} to {RynekData::%loop-index%::Cost} set {_owner::%loop-value%::%{RynekData::%loop-index%::Cost}%} to {RynekData::%loop-index%::Owner} set {_item::%loop-value%::%{RynekData::%loop-index%::Cost}%} to loop-value set {_top::*} to sorted indices of {_NewList::*} in descending order loop size of {Rynek::*} times: add 1 to {_n} set {_u} to {_top::%{_n}%} set {_split::*} to split {_u} at "." replace all ".%{_split::2}%" with "" in {_u} set {_b} to "%{_NewList::%{_u}%.%{_split::2}%}%" set {_p} to {_u} if {_b} is not set: set {_b} to "None" set {_p} to "0" add 1 to {_a} if {_a} > (26*{_strona})-26: set {_lore::*} to lore of {_item::%{_p}%::%{_b}%} set {_item} to {_item::%{_p}%::%{_b}%} named "&b%name of {_item::%{_p}%::%{_b}%} ? {_item::%{_p}%::%{_b}%}%" if uncolored {_item}'s name is "%{_item}'s type%": set {_item} to plain {_item} set {_item} to {_item} with lore {_lore::*} and "" and "&aSprzedawca: &6%{_owner::%{_p}%::%{_b}%}%" and "&aCena: &6%{_b}%$" and "" and "&eKliknij, aby kupic!" if {_search} is not " ": set slot 0 of {_player} to gray stained glass pane named "&k&7&l%{_search}%&k" if {_sort} is "Wszystko": if name of {_item} contains {_search}: set slot {_c} of {_player}'s inventory to {_item} add 1 to {_c} else if "%{_item}'s lore%" contains {_search}: set slot {_c} of {_player}'s inventory to {_item} add 1 to {_c} else if "%{_item}'s type%" contains {_search}: set slot {_c} of {_player}'s inventory to {_item} add 1 to {_c} else if "%plain {_item}%" contains {_search}: set slot {_c} of {_player}'s inventory to {_item} add 1 to {_c} if {_sort} is "Sprzedający": if line 2 of lore of {_item} contains {_search}: set slot {_c} of {_player}'s inventory to {_item} add 1 to {_c} if {_sort} is "Opis": if "%{_item}'s lore%" contains {_search}: set slot {_c} of {_player}'s inventory to {_item} add 1 to {_c} if {_sort} is "Typ": if "%{_item}'s type%" contains {_search}: set slot {_c} of {_player}'s inventory to {_item} add 1 to {_c} if {_sort} is "Nazwa": if name of {_item} contains {_search}: set slot {_c} of {_player}'s inventory to {_item} add 1 to {_c} if {_c} > 36-1: stop loop if {_c} is 9: set slot 22 of {_player}'s inventory to barrier named "&cNic Nie znaleziono!" set {_list::*} to "Wszystko" and "Sprzedający" and "Opis" and "Typ" and "Nazwa" loop {_list::*}: if {_sort} is loop-value: add "&3- &a%loop-value%" to {_lore::*} else: add "&3- &7%loop-value%" to {_lore::*} set slot 8 of {_player} to hopper named "&6Filtr szukania: %{_sort}%" with lore {_lore::*} set slot 4 of {_player} to oak door named "&7Wróc na Rynek " with lore "&8» &7Jeżeli nie widzisz w wyszukiwaniu" and "&7przedmiotu którego szukasz" and "&7możesz powrócić na rynek" and "" and "&6Strona: &f%{_page}%&7/&f%{_max}%" on inventory close: if type of player's current inventory is anvil inventory named "&6Rynek Szukaj:": wait 2 tick set slot (integers between 0 and 35) of player to air loop {itemki.%player's name%::*}: add loop-value to player delete {itemki.%player's name%::*} on anvil gui click: if event-integer is 0: set {_search} to "" searchGUI(player, {_search}, 1, false, "Wszystko") on inventory click: if name of current inventory of player contains "&8Rynek": cancel event if clicked slot is 51: if clicked slot is lectern: searchGUI(player, "", 1, true, "Wszystko") if type of player's current inventory is anvil inventory named "&6Rynek Szukaj:": cancel event if clicked slot > 8: if clicked slot < 36: set {_a::*} to uncolored lore of clicked slot loop {_a::*}: if "%loop-value%" contains "Sprzedawca:": set {_a} to loop-value if "%loop-value%" contains "Cena": set {_b} to loop-value set {_a::*} to {_a} split at " " set {_b::*} to {_b} split at " " replace all "$" with "" in {_b::2} set {_c} to clicked slot delete {_c}'s lore set name of {_c} to "" loop {Rynek::*}: if loop-value is {_c}: if "%{RynekData::%loop-index%::Owner}%" is player's name: if player doesn't have permission "ekonomy.admin": if clicked slot is not barrier named "&4Nie mozesz kupic swojego przedmiotu!": set {_a} to clicked slot set clicked slot to barrier named "&4Nie mozesz kupic swojego przedmiotu!" wait 1.5 seconds set clicked slot to {_a} stop if "%{RynekData::%loop-index%::Owner}%" is "%{_a::2}%": if "%{RynekData::%loop-index%::Cost}%" is "%{_b::2}%": if click type is right mouse button: if player has permission "ekonomy.admin": add {Rynek::%loop-index%} to {RynekData::ReturnStorage::%{RynekData::%loop-index%::Owner}%::*} add player's name to {RynekData::ReturnStorage_Admin::%{RynekData::%loop-index%::Owner}%::*} send "%{@prefix.rynek}%&4Admin &6%player's name%&4 wycofał Twój przedmiot ze sprzedaży!%nl%Możesz go odebrać w magazynie zwrotów!" to {RynekData::%loop-index%::Owner} send "%{@prefix.rynek}%&2Pomyślnie usunięto przedmiot z Rynku!" to player delete {Rynek::%loop-index%} delete {RynekData::%loop-index%::Owner} delete {RynekData::%loop-index%::Cost} delete {RynekData::%loop-index%::Owner} delete {RynekData::%loop-index%::Cost} set {_a::*} to uncolored lore of slot 4 of current inventory of player loop {_a::*}: if "%loop-value-2%" contains "Strona:": set {_a} to loop-value-2 set {_a::*} to {_a} split at " " set {_b::*} to {_a::2} split at "/" searchGUI(player, {_search}, {_b::1}, false, "Wszystko") stop if {Balance::%player's name%} >= {RynekData::%loop-index%::Cost} parsed as number: if size of {itemki.%player's name%::*} < 35: set {_search} to uncolored name of slot 0 of player add {Rynek::%loop-index%} to {itemki.%player's name%::*} delete {Rynek::%loop-index%} remove {RynekData::%loop-index%::Cost} from {Balance::%player's name%} add {RynekData::%loop-index%::Cost} to {Balance::%{RynekData::%loop-index%::Owner}%} send "%{@prefix.rynek}%&2Zakupiono przedmiot od &6%{RynekData::%loop-index%::Owner}%!" send "%{@prefix.rynek}%&2Gracz &6%player's uuid%&2 zakupil twoj przedmiot!" to {RynekData::%loop-index%::Owner} delete {RynekData::%loop-index%::Owner} delete {RynekData::%loop-index%::Cost} set {_a::*} to uncolored lore of slot 4 of current inventory of player loop {_a::*}: if "%loop-value-2%" contains "Strona:": set {_a} to loop-value-2 set {_a::*} to {_a} split at " " set {_b::*} to {_a::2} split at "/" searchGUI(player, {_search}, {_b::1}, false, "Wszystko") stop else: send "%{@prefix.rynek}%&4Nie masz miejsca w ekwipunku na ten przedmiot!" stop else: send "%{@prefix.rynek}%&4Brakuje ci %{RynekData::%loop-index%::Cost}-{Balance::%player's name%}% $!" stop if clicked slot is 3: if clicked slot is arrow: set {_search} to uncolored name of slot 0 of player set {_item} to item in slot 4 of player set {_lore::*} to line 5 of lore of {_item} split at " " set {_b::*} to {_lore::2} split at "/" replace all "&7" and "&f" with "" in {_b::1} searchGUI(player, {_search}, {_b::1} parsed as number -1, false, "Wszystko") if clicked slot is 4: open rynek(player, 1, "Wszystko", false, "None") to player if clicked slot is 5: if clicked slot is arrow: set {_search} to uncolored name of slot 0 of player set {_item} to item in slot 4 of player set {_lore::*} to line 5 of lore of {_item} split at " " set {_b::*} to {_lore::2} split at "/" replace all "&7" and "&f" with "" in {_b::1} searchGUI(player, {_search}, {_b::1} parsed as number +1, false, "Wszystko") if clicked slot is 8: set {_l::*} to lore of item in clicked slot loop {_l::*}: if loop-value contains "&3- &a": set {_list::*} to "Wszystko" and "Sprzedający" and "Opis" and "Typ" and "Nazwa" set {_check::*} to uncolored loop-value split at "- " loop {_list::*}: if {_next} is true: set {_correct} to loop-value-2 stop loop if loop-value-2 is {_check::2}: set {_next} to true set {_search} to uncolored name of slot 0 of player set {_item} to item in slot 4 of player set {_lore::*} to line 5 of lore of {_item} split at " " set {_b::*} to {_lore::2} split at "/" replace all "&7" and "&f" with "" in {_b::1} searchGUI(player, {_search}, 1, false, "%{_correct} ? "Wszystko"%") every 2 ticks: loop all players: if type of loop-player's current inventory is anvil inventory named "&6Rynek Szukaj:": set {_search} to the anvil text input of loop-player's current inventory wait 2 tick set {_searchCheck} to the anvil text input of loop-player's current inventory if {_searchCheck} is not {_search}: set {_item} to item in slot 8 of loop-player set {_l::*} to name of {_item} split at " " set {_sort} to {_l::3} set {_item} to item in slot 4 of loop-player set {_lore::*} to line 5 of lore of {_item} split at " " set {_b::*} to {_lore::2} split at "/" replace all "&7" and "&f" with "" in {_b::1} searchGUI(loop-player, {_searchCheck}, {_b::1}, false, {_sort}) on join: if {itemki.%{_player}'s name%::*} is set: set slot (integers between 0 and 35) of player to air loop {itemki.%player's name%::*}: add loop-value to player delete {itemki.%player's name%::*}