options: debug: false codes: 0|1|2|3|4|5|6|7|8|9|a|b|c|d|e|f|k|l|m|n|o|r function removeColor(msg: text) :: text: set {_m::*} to {_msg} split at "" set {_color-codes} to "{@codes}" set {_colors::*} to {_color-codes} split at "|" set {_new} to "" loop {_m::*}: set {_char} to loop-value set {_prev} to the last character of {_new} if {_prev} is "&": loop {_colors::*}: if loop-value-2 is {_char}: set {_skip} to true if {_skip} is set: delete {_skip} else: set {_new} to "%{_new}%%{_char}%" return {_new} function jsonColorize(msg: text, default-color: text = "&r") :: text: set {_m::*} to {_msg} split at "" set {_color-codes} to "{@codes}" set {_colors::*} to {_color-codes} split at "|" set {_color} to colored {_default-color} set {_code} to the first character of {_color} set {_new} to "" set {_skip} to 0 loop amount of {_m::*} times: if {_skip} is more than or equal to 1: subtract 1 from {_skip} else: set {_char} to {_m::%loop-number%} set {_next} to {_m::%loop-number + 1%} if {@debug} is true: broadcast "&a[Character Check] &r%loop-number%: &7%{_char}% &r&onext: &8%{_next}% &r[%{_color}%color&r]" if {_char} is "&" or {_code}: if {@debug} is true: broadcast "&a[Color Check] &rFOUND: &o%{_char}%%{_next}% &7&m<--&7&o is it valid?" loop {_colors::*}: if loop-value-2 is {_next}: set {_color} to "%{_color}%%{_code}%%{_next}%" if {_next} is "r": set {_color} to {_default-color} set {_new} to "%{_new}%%{_color}%" set {_skip} to 1 if {_skip} is less than or equal to 0: set {_new} to "%{_new}%%{_char}%" else if {_char} is " ": set {_new} to "%{_new}% %{_color}%" else: set {_new} to "%{_new}%%{_char}%" return {_new} function jsonSanitize(msg: text) :: text: if {@debug} is true: broadcast "&a[Sanitize] &7&oSanitizing input..." set {_m::*} to {_msg} split at "" loop {_m::*}: if loop-value is """": set {_m::%loop-index%} to "\""" # """ else if loop-value is "\": set {_m::%loop-index%} to "\\" set {_new} to join {_m::*} with "" return {_new} function jsonFormat(msg: text, color: boolean = true) :: text: set {_m::*} to {_msg} split at "||" set {_current} to 1 loop {_m::*}: if {_clusters::%{_current}%} is not set: set {_clusters::%{_current}%} to "" if {_clusters::%{_current}%::text} is not set: set {_clusters::%{_current}%::text} to jsonSanitize(loop-value) else: set {_tag} to the first 4 characters of loop-value set {_value} to subtext of loop-value from characters 5 to the length of loop-value if {_tag} is "ttp:": set {_clusters::%{_current}%::tooltip} to jsonSanitize({_value}) else if {_tag} is "cmd:": set {_clusters::%{_current}%::command} to jsonSanitize({_value}) else if {_tag} is "sgt:": set {_clusters::%{_current}%::suggest} to jsonSanitize({_value}) else if {_tag} is "url:": if {_value} doesn't contain "http://" or "https://": set {_value} to "http://%{_value}%" set {_clusters::%{_current}%::url} to jsonSanitize({_value}) else if {_tag} is "ins:": set {_clusters::%{_current}%::insertion} to jsonSanitize({_value}) else: add 1 to {_current} set {_clusters::%{_current}%::text} to jsonSanitize(loop-value) set {_clusters::%{_current}%} to "" if {@debug} is true: broadcast "&a[Tag Check] &3cluster:&b%{_current}% &8(&f&o%{_tag}%&8)" loop {_clusters::*}: if {@debug} is true: broadcast "&a[Cluster Check] &7&oCluster ##%loop-index% exists." set {_i} to loop-index set {_text} to {_clusters::%{_i}%::text} if {_color} is true: set {_text} to jsonColorize({_text}) if {_json} is not set: set {_json} to "{""text"":""%{_text}%""" else: set {_json} to "%{_json}%,{""text"":""%{_text}%""" if {_clusters::%{_i}%::tooltip} is set: if {_color} is true: set {_tooltip} to jsonColorize({_clusters::%{_i}%::tooltip}) else: set {_tooltip} to {_clusters::%{_i}%::tooltip} set {_json} to "%{_json}%,""hoverEvent"":{""action"": ""show_text"",""value"": ""%{_tooltip}%""}" if {_clusters::%{_i}%::insertion} is set: set {_json} to "%{_json}%,""insertion"":""%{_clusters::%{_i}%::insertion}%"",""obfuscated"":false" if {_clusters::%{_i}%::command} is set: set {_clickable} to "%{_json}%,""clickEvent"":{""action"":""run_command"",""value"":""%{_clusters::%{_i}%::command}%""}" if {_clusters::%{_i}%::suggest} is set: set {_clickable} to "%{_json}%,""clickEvent"":{""action"": ""suggest_command"",""value"": ""%{_clusters::%{_i}%::suggest}%""}" if {_clusters::%{_i}%::url} is set: set {_clickable} to "%{_json}%,""clickEvent"":{""action"": ""open_url"",""value"": ""%{_clusters::%{_i}%::url}%""}" if {_clickable} is set: set {_json} to "%{_clickable}%}" delete {_clickable} else: set {_json} to "%{_json}%}" return "[{""text"":""""},%{_json}%]" # \\\"""" function json(to: text, msg: text, color: boolean = true): set {_msg} to jsonFormat({_msg}, {_color}) execute console command "/tellraw %{_to}% %{_msg}%" if {@debug} is true: set {_player} to {_to} parsed as offline player if {_player} is online: send uncolored {_msg} to {_player} function jsonBroadcast(msg: text, color: boolean = true): json("@a", {_msg}, {_color}) command /json [] []: permission: "is.op" trigger: set {_to} to arg 1 set {_msg} to arg 2 if arg 1 is not set: set {_to} to "%player%" if arg 2 is not set: set {_msg} to "This is a json message! &c&oClick here for no reason!||ttp:&lReally, click your mouse!||cmd:/json @a %{_to}% clicked their mouse on json..." json({_to}, {_msg}) command /qmanager [] [] []: permission: qapi.admin permission message: &6> &cNie masz uprawnien &4(&eqapi.admin&4) aliases: man, qman, qm, pmanager, manager trigger: if arg 1 is "pomoc": send "&6> &8/qm pliki [folder] {rodzaj} &6- &8Wyswietla pliki z danego folderu." send "&6> &8/qm zobacz [plik] &6- &8Wyswietla zawartosc pliku." send "&6> &8/qm pobierz [plik] [link] &6- &8Pobiera skrypt/tekst z danej strony." send "&6> &cPAMIETAJ ZE MA BYC TO RAW!" send "&6> &8/qm usun [plik/folder] &6- &8Usuwa plik lub caly folder." send "&6> &8/qm stworz [plik/folder] &6- &8Tworzy plik albo pusty folder." if arg 1 is "pliki": if arg 2 is set: if folder "%arg-2%" exists: set {_files::*} to files in "%arg-2%" set {_amof} to 0 loop {_files::*}: add 1 to {_amof} if "%loop-value%" contains ".sk" or ".yml" or ".yaml" or ".txt": execute console command "/json %player% &6> &e%loop-value% ||&bZOBACZ||ttp:&aNacisnij aby wyswietlic zawartosc pliku.||cmd:/zrob %player% /qm zobacz %arg-2%/%loop-value%|| &cUSUN||ttp:&cNacisnij aby usunac plik!||cmd:/zrob %player% /qm usun %arg-2%/%loop-value%" else: execute console command "/json %player% &6> &e%loop-value% || &cUSUN||ttp:&cNacisnij aby usunac plik!||cmd:/zrob %player% /qm usun %arg-2%/%loop-value%" send "&aLaczna ilosc plikow &6%{_amof}%" else: send "&cNie ma takiego folderu&8. &8Podaj sciezke np. plugins/Skript" stop else: send "&cPodaj sciezke do folderu&8." stop if arg 1 is "usun": if arg 2 is set: if file "%arg-2%" exists: delete file "%arg-2%" send "&aPoprawnie usunieto plik &6%arg-2%" else: send "&cNie ma takiego pliku&8." stop else: send "&cPodaj sciezke do pliku&8." stop if arg 1 is "stworz": if arg 2 is set: create file "%arg-2%" send "&aStworzono &6%arg-2%" else: send "&cPodaj sciezke do pliku&8." stop if arg 1 is "pobierz": if arg 2 is set: if arg 3 is set: download from "%arg-3%" to "%arg-2%" send "&aPobieranie zakonczone" else: send "&cPodaj link do pliku RAW&8." stop else: send "&cPodaj sciezke do pliku&8." stop if arg 1 is "zobacz": if arg 2 is set: if file "%arg-2%" exists: set {_this::*} to content of file "%arg-2%" set {_linie} to 0 loop {_this::*}: add 1 to {_linie} set {_abc} to "%loop-value%" parsed as text replace all " " in {_abc} with " " send "%{_abc}%" send "&aLinijki: &e%{_linie}%" else: send "&cNie ma takiego pliku&8." stop else: send "&cPodaj sciezke do pliku&8." stop command /zrob [] []: permission: op trigger: execute player-arg command "%arg-2%"