options: dir: /plugins/Skript/pyraHeads/ url: https://pastebin.com/raw/neKrLDKL cmd: head perm: ph.use gui_background_item: light gray glass pane gui_background_slots: 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 25, 28, 29, 30, 31, 32, 33, 34, 37, 38, 39, 40, 41, 42 and 43 gui_background_frame_item: gray glass pane gui_name: &e&lp&6&lH&r gui_main_item: sunflower gui_category_item: snowball gui_name_color: &f gui_button_previus_slot: 47 gui_button_previus_item: red glass pane named "&cPoprzednia Strona" gui_button_next_slot: 51 gui_button_next_item: light green glass pane named "&aNastepna Strona" gui_button_back_slot: 49 gui_button_back_item: barrier named "&cKliknij aby zamknac." function phGetList(t: string) :: strings: set {_files::*} to files in dir {_t} loop {_files::*}: if loop-value ends with ".txt": add (subtext of loop-value from character (last index of "/" in loop-value + 1) to character (length of loop-value - 4)) to {_return::*} else: add (subtext of loop-value from character (last index of "/" in loop-value + 1) to character (length of loop-value)) to {_return::*} return {_return::*} function phAddButtons(p: player, c: string, n: string): if {_n} != "": format gui slot (integers from 45 to 53) of {_p} with {@gui_background_frame_item} set {_files::*} to phGetList("{@dir}%{_c}%/") loop {_files::*}: if loop-value = {_n}: set {_index} to loop-index parsed as integer if {_index} != 1: set {_} to {_index} - 1 format gui slot {@gui_button_previus_slot} of {_p} with {@gui_button_previus_item} to run {_p} command "/{@cmd} %{_c}% %{_files::%{_}%}%" if {_index} != size of {_files::*}: set {_} to {_index} + 1 format gui slot {@gui_button_next_slot} of {_p} with {@gui_button_next_item} to run {_p} command "/{@cmd} %{_c}% %{_files::%{_}%}%" stop loop format gui slot {@gui_button_back_slot} of {_p} with {@gui_button_back_item} to run {_p} command "/{@cmd} %{_c}%" else: if {_c} != "": format gui slot {@gui_button_back_slot} of {_p} with {@gui_button_back_item} to run {_p} command "/{@cmd}" function phAddBackground(p: player, c: string, n: string): if {_n} = "": format gui slot (integers from 0 to 53) of {_p} with {@gui_background_frame_item} format gui slot {@gui_background_slots} of {_p} with {@gui_background_item} else: format gui slot (integers from 0 to 53) of {_p} with {@gui_background_item} function phSetGui(p: player, c: string="", n: string=""): open virtual chest inventory with 6 rows named "{@gui_name} %{_c}% %{_n}%" to {_p} phAddBackground({_p}, {_c}, {_n}) if {_n} = "": if {_c} = "": set {_files::*} to phGetList("{@dir}") loop {@gui_background_slots}: loop {_files::*}: format gui slot loop-value-1 of {_p} with {@gui_main_item} named "{@gui_name_color}%loop-value-2%" to run {_p} command "/{@cmd} %loop-value-2%" delete {_files::%loop-index%} stop loop else: set {_files::*} to phGetList("{@dir}%{_c}%/") loop {@gui_background_slots}: loop {_files::*}: format gui slot loop-value-1 of {_p} with {@gui_category_item} named "{@gui_name_color}%loop-value-2%" to run {_p} command "/{@cmd} %{_c}% %loop-value-2%" delete {_files::%loop-index%} stop loop else: set {_nbt::*} to file contents of "{@dir}%{_c}%/%{_n}%.txt" loop {_nbt::*}: set {_item} to player head with item-nbt loop-value format gui slot (loop-index parsed as integer - 1) of {_p} with {_item} to run function phGiveItem({_p}, {_item}) phAddButtons({_p}, {_c}, {_n}) function phGiveItem(p: player, i: item): set lore of {_i} to "pyraHeads" give {_i} to {_p} loop all items in {_p}'s inventory: if lore of loop-item contains "pyraHeads": set 1st line of lore of loop-item to "" on load: if dir "{@dir}" does not exist: set {_files::*} to contents from url "{@url}" set {_nbt::*} to "" loop {_files::*}: if loop-value does not start with "{": if loop-index != "1": set file contents of "{@dir}%{_name::1}%/%{_name::2}%.txt" to {_nbt::*} set {_name::*} to loop-value split at "||" if loop-value != "||": create file "{@dir}%{_name::1}%/%{_name::2}%.txt" delete {_nbt::*} else: add loop-value to {_nbt::*} command /{@cmd} [] []: permission: {@perm} trigger: if arg 1 is not set: phSetGui(player) else: if arg 2 is not set: phSetGui(player, arg 1) else: phSetGui(player, arg 1, arg 2) #Created by ZiemniaQ v3.1 09.09.2019 19:40