skript-reload-shorthands-r1.1.sk

Created by jaylawl

Other available versions. Ordered by newest to oldest versions:

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

#
# created by jaylawl
# contact: [email protected]
#
# requires SkUtilities 0.9.0 (or later) to function
# soft-requires SkQuery - remove the "%nl%" expressions if you don't want to use that
#
# version 1.1
#

options:
    prefix : &7[&4MK&7]&r
    
    # by default, this directory path should work
    # if it doesn't try adding the full path (starting at server's root folder)
    directory : /plugins/Skript/scripts
    
    # set this to false if you don't care for your script's reload times
    print timings : true
    
    # requires the executing player to have the "skript.admin" permission
        
command /sra:
    trigger:
        
        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 [<text>]:
    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} != "-"
            set {_t} to system milliseconds
            if command sender = player:
                player command "skript reload %{_file}%"
            else:
                console command "skript reload %{_file}%"
            set {_t} to (system milliseconds - {_t})
            add {_t} to {_total-time}
            {@print timings} = true
            if command sender = player:
                set {_tooltip} to "%{_tooltip}%%nl%&7""%{_file}%"": &a%{_t}% ms&r"
            else:
                send "&7""%{_file}%"": &a%{_t}% ms&r"
        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<tooltip:%{_tooltip}%>[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"