#Version: 1.0 options: #W zależności od wersji twojej SkQuery wybierz ustawienie ścieżki do plugins #Te ustawienie jest na SkQuery file: "../../Kits/config.yml" base: "../../Kits/players.yml" #Te ustawienie jest na SkQuery w wersji Lime #file: "plugins/Kits/config.yml" #base: "plugins/Kits/players.yml" function getItemByText(t: text) :: item: if "%{_t}%" contains "named": set {_item} to subtext of {_t} between index 0 to index of "named" in {_t} - 2 set {_item} to {_item} parsed as item type if {_item} is not item type: return air if "%{_t}%" contains "with lore": set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to index of "with lore" in {_t} - 3 set {_lore} to subtext of {_t} between index index of "with lore" in {_t} + 11 to length of {_t} - 1 return {_item} named coloured {_name} with lore coloured {_lore} else: set {_name} to subtext of {_t} between index index of "named" in {_t} + 7 to length of {_t} - 1 return {_item} named coloured {_name} if "%{_t}%" contains "with lore": set {_item} to subtext of {_t} between index 0 to index of "with lore" in {_t} - 2 set {_lore} to subtext of {_t} between index length of "%{_item}%" + 13 to index length of {_t} - 1 set {_item} to {_item} parsed as item type if {_item} is item type: return {_item} with lore coloured {_lore} return air set {_item} to {_t} parsed as item type if {_item} is item type: return {_item} return air function getIdFromItem(t: text) :: object: set {_kits::*} to yaml nodes "kits" from {@file} loop {_kits::*}: set {_item} to yaml value "kits.%loop-value%.displayItem" from {@file} if getItemByText({_item})'s name is {_t}: return "%loop-value%" return null function getAllItemsFromKit(ID: text) :: item types: set {_items::*} to yaml list "kits.%{_ID}%.items" from {@file} loop {_items::*}: add getItemByText("%loop-value%") to {_repairItems::*} return {_repairItems::*} function getTime(id: text, p: player) :: string: set {_sec} to 1000 set {_min} to 60 * {_sec} set {_hour} to 60 * {_min} set {_day} to 24 * {_hour} set {_conf} to yaml value "kits.%{_id}%.%{_p}%" from {@base} set {_ms} to {System}.currentTimeMillis() - {_conf} if "%{_ms}%" contains "-": set {_ms} to "%{_ms}%" replace all "-" with "" in {_ms} set {_ms} to {_ms} parsed as number set {_res} to "" if {_ms} > {_day}: set {_res} to "%{_res}% %floor({_ms} / {_day})% dni " set {_ms} to {Math}.floorMod({_ms} and {_day}) if {_ms} > {_hour}: set {_res} to "%{_res}%%floor({_ms} / {_hour})% godz. " set {_ms} to {Math}.floorMod({_ms} and {_hour}) if {_ms} > {_min}: set {_res} to "%{_res}%%floor({_ms} / {_min})% min. " set {_ms} to {Math}.floorMod({_ms} and {_min}) if {_ms} > {_sec}: set {_res} to "%{_res}%%floor({_ms} / {_sec})% sek." set {_ms} to {Math}.floorMod({_ms} and {_sec}) return {_res} return "&aTeraz" function getInventory(t: text, p: player) :: inventory: #Enums: #MAIN #ID if {_t} is "MAIN": set {_kits::*} to yaml nodes "kits" from {@file} set {_rows} to ceil("%size of {_kits::*}%" parsed as integer / 9) set {_x} to chest with {_rows} rows named "&eZestawy" loop {_kits::*}: set {_pex} to yaml value "kits.%loop-value%.permission" from {@file} if {_pex} is not "": if {_p} has permission "%{_pex}%": set {_hasPermission} to "&aTAK" else: set {_hasPermission} to "&cNIE" else: set {_hasPermission} to "&aTAK" set {_lore::1} to " &7Posiadasz uprawnienia: %{_hasPermission}%" set {_lore::2} to " &7Dostepny za: %getTime(loop-value, {_p})%" set {_timespan} to yaml value "kits.%loop-value%.time" from {@file} replace all "minutes" and "minute" with "min." in {_timespan} replace all "seconds" and "second" with "sek." in {_timespan} replace all "days" and "day" with "dni." in {_timespan} replace all "hours" and "hour" with "godz." in {_timespan} replace all " and " with " " in {_timespan} set {_lore::3} to " &7Zestaw mozna brac raz na: &a%{_timespan}%" if yaml value "kits.%loop-value%.activate" from {@file} is true: set {_activate} to "&awlaczony" else: set {_activate} to "&cwylaczony" set {_lore::4} to " &7Zestaw jest w tej chwili: %{_activate}%" set {_lore::5} to "" set {_lore} to "%{_lore::*}%" replace all ", " and " and " with "||" in {_lore} set {_lore} to "%{_lore}%|| &eKliknij LPM, aby wziac zestaw.|| &eKliknij PPM, aby obejrzec zestaw." set {_yaml} to yaml value "kits.%loop-value%.displayItem" from {@file} set {_item} to getItemByText({_yaml}) set slot loop-index parsed as integer - 1 of {_x} to {_item} named " &eZestaw: %coloured name of {_item}%" with lore {_lore} clear {_pex}, {_lore::*}, {_timespan}, {_activate}, {_lore}, {_yaml} and {_item} return {_x} if yaml value "kits.%{_t}%.displayItem" from {@file} is set: set {_yaml} to yaml value "kits.%{_t}%.displayItem" from {@file} set {_item} to getItemByText({_yaml}) set {_items::*} to getAllItemsFromKit({_t}) set {_rows} to ceil("%size of {_items::*}%" parsed as integer / 9) set {_x} to chest with {_rows} rows named "&eZestaw: %coloured name of {_item}%" loop {_items::*}: set slot loop-index parsed as integer - 1 of {_x} to loop-value return {_x} on script load: import "java.lang.Math" import "java.lang.Long" import "java.lang.System" import "org.bukkit.event.inventory.InventoryClickEvent" if yaml value "autoRefreshInGUI" from {@file} is not set: set yaml value "autoRefreshInGUI" from {@file} to true if yaml nodes "kits" from {@file} is not set: set yaml value "kits.test.displayItem" from {@file} to "64 steak named ""&8Moj test &r&lKit""" set yaml value "kits.test.permission" from {@file} to "" set yaml value "kits.test.time" from {@file} to "5 hour" set yaml value "kits.test.activate" from {@file} to true add "64 steak named ""&7Start"" with lore ""&eTwoje startowe miesko||||&c&lSMACZNEGO!""" to yaml list "kits.test.items" from {@file} add "diamond pickaxe of efficiency 10 and unbreaking 3 named ""&6Super kox"" with lore ""&6Kopie 3x3||||&cSerdecznie polecam||&3&l&nKnugi""" to yaml list "kits.test.items" from {@file} set yaml value "kits.drugi.displayItem" from {@file} to "wooden sword named ""&cKit &lVIP""" set yaml value "kits.drugi.permission" from {@file} to "easyhc.vip" set yaml value "kits.drugi.time" from {@file} to "2 days and 32 minutes" set yaml value "kits.drugi.activate" from {@file} to false add "diamond helmet of protection 4 and unbreaking 3 named ""&6Helm VIP'a""" to yaml list "kits.drugi.items" from {@file} add "diamond chestplate of protection 4 and unbreaking 3 named ""&6Zbroja VIP'a""" to yaml list "kits.drugi.items" from {@file} add "diamond leggings of protection 4 and unbreaking 3 named ""&6Spodnie VIP'a""" to yaml list "kits.drugi.items" from {@file} add "diamond boots of protection 4 and unbreaking 3 named ""&6Buty VIP'a""" to yaml list "kits.drugi.items" from {@file} add "diamond sword of sharpness 5 and unbreaking 3 named ""&6Miecz VIP'a""" to yaml list "kits.drugi.items" from {@file} on "org.bukkit.event.inventory.InventoryClickEvent": set {_name} to event.getWhoClicked().getOpenInventory().getTopInventory().getName() if "%{_name}%" contains "&eZestaw:": cancel event if event.isRightClick() is true: set {_p} to event.getWhoClicked() close {_p}'s inventory wait 2 tick open getInventory("MAIN", {_p}) to {_p} stop if "%{_name}%" is "&eZestawy": cancel event if "%event.getCurrentItem()%" is "0 air": stop set {_p} to event.getWhoClicked() set {_id} to getIdFromItem(event.getCurrentItem().getItemMeta().getDisplayName().substring(11)) if yaml value "kits.%{_id}%.displayItem" from {@file} is set: if event.isShiftClick() is true: stop if event.isLeftClick() is true: set {_lore::*} to split "%lore of event.getCurrentItem()%" by "||" if "%{_lore::2}%" doesn't contain "&aTeraz": stop if "%{_lore::4}%" contains "wylaczony": stop give {_p} getAllItemsFromKit({_id}) set {_timespan} to yaml value "kits.%{_id}%.time" from {@file} set {_broadcast} to yaml value "kits.%{_id}%.broadcast" from {@file} if {_broadcast} is true: broadcast "&c* &7Gracz %{_p}% wzial kit: %event.getCurrentItem().getItemMeta().getDisplayName().substring(11)%" close {_p}'s inventory set {_timespan} to {_timespan} parsed as timespan set {_time} to now add {_timespan} to {_time} set yaml value "kits.%{_id}%.%{_p}%" from {@base} to {_time}.getTimestamp() stop if event.isRightClick() is true: close {_p}'s inventory wait 2 tick open getInventory({_id}, {_p}) to {_p} stop command /kit []: aliases: kits trigger: open getInventory("MAIN", player) to player every 2 second: if yaml value "autoRefreshInGUI" from {@file} is true: loop all players: if "%inventory name of loop-player's current inventory%" is "&eZestawy": set {_items::*} to all items in loop-player's current inventory loop {_items::*}: if "%lore of loop-value-2%" doesn't contain "&7Dostepny za: &aTeraz": set {_lore} to lore of loop-value-2 set {_name} to subtext of name of loop-value-2 between index 12 and length of name of loop-value-2 set {_id} to getIdFromItem({_name}) set {_oldTime} to subtext of {_lore} between index index of "Dostepny za:" in {_lore} + 13 and index index of "Zestaw mozna" in {_lore} - 6 set {_newTime} to getTime({_id}, loop-player) replace all {_oldTime} with "&7%{_newTime}%" in {_lore} set loop-player's current inventory's slot loop-index parsed as integer - 1 to loop-value-2 with lore {_lore} clear {_lore}