# # SKRIPT RELOAD SHORTHANDS # version 1.2 # contact: jaylawlmc@gmail.com # # dependencies: # - Skript | any remotely recent version should work # - SkUtilities 0.9.0 | https://forums.skunity.com/resources/skutilities.26/ # - SkQuery | https://forums.skunity.com/resources/unofficial-skquery-fork-1-6-1-12.68/updates # | SkQuery is not vital for this to work. Remove the %nl% expressions from the script and SkQuery will be unneccessary # options: prefix : &8[&eSRS&8]&r # if this directory path doesn't work, try adding the full path (starting at server's root folder) directory : /plugins/Skript/scripts priority load : true # whether scripts prefixed with "_" should be loaded before others priority prefix : _ # this supports multiple characters print timings : true # if timings should be printed block native commands : false # blocks usage of the "/skript reload all" and "/skript reload scripts" commands # requires the executing player to have the "skript.admin" permission on command: {@block native commands} = true "%command% %arguments%" = "skript reload all" or "skript reload scripts" cancel event send "{@prefix} &cCommand blocked; Please use &f""/srs"" &cinstead" command /sra: trigger: if {@block native commands} = true: command sender has permission "skript.admin" send "{@prefix} &cCommand blocked; Please use &f""/srs"" &cinstead" else: if command sender = player: if command sender does not have permission "skript.admin": send "&cInsufficient permission" else: player command "skript reload all" else: console command "skript reload all" command /srs []: trigger: command sender does not have permission "skript.admin": send "&cInsufficient permission" stop if arg 1 is not set: send "{@prefix} &7Reloading all scripts" set {_query} to "" else: set {_query} to arg 1 send "{@prefix} &7Reloading all scripts containing ""%{_query}%""..." command sender = player: set {_tooltip} to "&f&lTimings" loop files in dir including sub dirs "{@directory}": loop-value contains "%{_query}%" loop-value contains ".sk" set {_file} to loop-value replace "{@directory}" in {_file} with "" set {_check} to {_file} while {_check} contains "/": set {_check} to subtext of {_check} from characters 2 to length of {_check} first character of {_check} != "-" if {@priority load} = true: if first (length of "{@priority prefix}") characters of {_check} = "{@priority prefix}": add {_file} to {_files-priority::*} else: add {_file} to {_files-normal::*} else: add {_file} to {_files-normal::*} set {_type} to "priority" loop 2 times: loop {_files-%{_type}%::*}: set {_t} to system nanoseconds if command sender = player: player command "skript reload %loop-value-2%" else: console command "skript reload %loop-value-2%" set {_t} to ((system nanoseconds - {_t}) / 1000000) add {_t} to {_total-time} {@print timings} = true if command sender = player: set {_tooltip} to "%{_tooltip}%%nl%&7""%loop-value-2%"": &a%{_t}% ms&r" else: send "&7""%loop-value-2%"": &a%{_t}% ms&r" set {_type} to "normal" if command sender = player: if {@print timings} = true: set {_tooltip} to "%{_tooltip}%%nl%Total time: &a%({_total-time} / 1000)% s&r" send "{@prefix} &aReloading script(s) complete &f- &7[Timings]" else: send "{@prefix} &aReloading script(s) complete &f- Total time: &a%({_total-time} / 1000)% s&r" else: send "{@prefix} &aReloading script(s) complete &f- Total time: &a%({_total-time} / 1000)% s&r"