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.
# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
# ░░ ░░
# ░░ ███████╗███████╗██╗ ██╗ ░░
# ░░ ██╔════╝██╔════╝██║ ██║ ░░
# ░░ ███████╗█████╗ ███████║ ░░
# ░░ ╚════██║██╔══╝ ██╔══██║ ░░
# ░░ ███████║██║ ██║ ██║ ░░
# ░░ ╚══════╝╚═╝ ╚═╝ ╚═╝ ░░
# ░░ ░░
# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
# Errors:
# - 126 = File already exists or there's a file with similar name in the same path.
# - 512 = Something is missing.
# - 891 = Spooky error, this means one of the files exists but is missing values.
options:
permission: sfh.admin
# People with this permission get access to the messages in chat and commands
# Default: sfh.admin
permission error: You don't have permission to use this!
# Message given to players when they have attempt to use "/sfh" without permission.
# Default: You don't have permission to use this!
path: plugins/Skript/scripts/
# This is the path where your skript files will be located at. IT'S BEST IF YOU DON'T CHANGE THIS UNLESS NECESSARY
# If the path doesn't go to scripts folder, this may cause issues with auto reloading
# Default: plugins/Skript/scripts/
auto reloading path: plugins/Skript/scripts/
# When trying to find the file, it will take this value from the path to attempt to reload the file.
# In other words, if the file is at "plugins/Skript/scripts/test.sk" then attempt to make it "test.sk" and auto-reload it
# If path is something in the lines of "plugins/Skript/scripts/Test/" then it should be "plugins/Skript/scripts" as, for file
# directories, you need to include a "/" at the start of the file in order to reload it.
# Default: plugins/Skript/scripts/
# ############################################ #
# ## ## #
# ## ## #
# ## DON'T TOUCH THIS UNLESS ## #
# ## YOU KNOW WHAT ## #
# ## YOU'RE DOING ## #
# ## ## #
# ## ## #
# ############################################ #
prefix: <##942121>&l[<##8C1D1D>&lS<##841818>&lF<##7B1414>&lH<##730F0F>&l]<##b01e1e>
version: 1.0.1
url: https://raw.githubusercontent.com/KingDooms01/SkriptFilesHub/main/list.json
import:
java.io.File
java.util.Scanner
java.net.URL
java.io.FileWriter
com.destroystokyo.paper.profile.ProfileProperty
java.net.http.HttpRequest
java.net.http.HttpClient
java.net.http.HttpResponse
java.net.URI
org.json.simple.parser.JSONParser
org.bukkit.Bukkit
ch.njol.skript.ScriptLoader
ch.njol.skript.SkriptCommand
on load:
wait 5 ticks
delete {sfh_files::*}
delete {sfh_list::*}
delete {sfh_allowedtodoanything}
set {_timetooked} to now
set {_url} to "{@url}"
set {_ourl} to "https://pastebin.com/raw/ELD3EFXD"
set {_session} to betterDoGetRequest({_url})
set {_osession} to betterDoGetRequest({_ourl})
set {_properties} to parseJSON({_session}).get("list")
set {_oproperties} to parseJSON({_osession}).get("properties")
set {_json} to first element of ...{_properties}
set {_ojson} to first element of ...{_oproperties}
while true is true:
add 1 to {_a}
set {_q} to {_json}.get("%{_a}%")
if {_q} is not set:
stop loop
sfh_getinfoelements({_q}, {_a})
set {sfh_properties::discord} to {_ojson}.get("discord")
set {sfh_properties::credits} to {_ojson}.get("credits")
set {_v} to {_ojson}.get("version")
if "%{_v}%" != "{@version}":
send "{@prefix} Skript Files Hub is outdated! You're on update {@version}, while the new version is %{_v}%" to allOpPlayers()
set {_time} to difference between {_timetooked} and now
send "{@prefix} It took %{_time}% to get all the data." to allOpPlayers()
set {sfh_allowedtodoanything} to true
stop
local function parseJSON(s: string) :: object:
return (new JSONParser()).parse({_s})
local function allOpPlayers() :: players:
loop all players:
loop-player has permission "{@permission}"
add loop-player to {_p::*}
return {_p::*}
command /skriptfileshub [<integer>]:
aliases: /sfh
permission: {@permission}
permission message: {@prefix} {@permission error}
trigger:
if {sfh_allowedtodoanything} != true:
send "{@prefix} Wait for the data to load." to player
stop
sfh_openGUI(player, (arg-1 ? 1))
local function eItem(i: item, tof: boolean=false) :: item:
set {_oi} to {_i} with all flags hidden
enchant {_oi} with infinity if {_tof} is true
return {_oi}
function sfh_openGUI(p: player, page: number=1):
set (metadata tag "sfh_gui" of {_p}) to chest inventory with 6 rows named (mini message from "<gradient:##730F0F:##b01e1e><bold>Skript Files Hub [Page %abs({_page})%]")
set slot 0,8,45,53 of (metadata tag "sfh_gui" of {_p}) to red stained glass named "&r"
set slot 1,3,4,5,7,46,47,48,49,50,51,52 of (metadata tag "sfh_gui" of {_p}) to gray stained glass pane named "&r"
set slot 2 of (metadata tag "sfh_gui" of {_p}) to eItem((redstone comparator item named "&aSettings"), true)
set slot 4 of (metadata tag "sfh_gui" of {_p}) to eItem((writable book named "<##00FF00>&nWanna upload your code onto here?" with lore "&aClick here to join our discord," and "&ayou'll be able to upload" and "&ayour files through there."), true)
set {_credits} to nametag named "&aCredits:" with lore (formatted {sfh_properties::credits} split by "||") ? ""
set slot 6 of (metadata tag "sfh_gui" of {_p}) to eItem({_credits}, true)
set slot 49 of (metadata tag "sfh_gui" of {_p}) to eItem((birch wood floor sign named "&cCurrent Page: &n%{_page}%"), true)
if {_page} > 1:
set {_i} to arrow named "&c<- Go to page %{_page} -1%"
set tag "GoPage" of (nbt of {_i}) to {_page} - 1
set slot 47 of (metadata value "sfh_gui" of {_p}) to {_i}
set {_nextpage} to (abs({_page}) * 36) +1
if {sfh_list::%{_nextpage}%} is set:
set {_i} to arrow named "&c<- Go to page %{_page} +1%"
set tag "GoPage" of (nbt of {_i}) to {_page} + 1
set slot 51 of (metadata value "sfh_gui" of {_p}) to {_i}
loop 36 times:
delete {_vu}
set {_fulln} to (abs({_page} -1) * 36) + loop-value
if {sfh_options::%uuid of {_p}%::sorting} is set:
delete {_a}
if {sfh_options::%uuid of {_p}%::sorting} is "A-Z":
loop indexes of {sfh_alphabetorder::*}:
add 1 to {_a}
{_a} = {_fulln}
set {_vu} to {sfh_list::%{sfh_alphabetorder::%loop-value-2%}%}
stop loop
else if {sfh_options::%uuid of {_p}%::sorting} is "Z-A":
loop reversed (indexes of {sfh_alphabetorder::*}):
add 1 to {_a}
{_a} = {_fulln}
set {_vu} to {sfh_list::%{sfh_alphabetorder::%loop-value-2%}%}
stop loop
else:
set {_vu} to {sfh_list::%{_fulln}%}
if {_vu} is set:
set {_i} to sfh_getItem({_vu})
set slot (8 + loop-value) of (metadata tag "sfh_gui" of {_p}) to {_i}
else:
stop loop
open (metadata tag "sfh_gui" of {_p}) to {_p}
function sfh_openWarningGUI(p: player, file: string, page: number=1):
set (metadata tag "sfh_warning" of {_p}) to chest inventory with 3 rows named (mini message from "<gradient:##730F0F:##8c1616:##730F0F><bold>Are you sure?")
set {_i} to red stained glass named "&r"
set tag "file" of (nbt of {_i}) to {_file}
set tag "page" of (nbt of {_i}) to {_page}
set slot 0 of (metadata tag "sfh_warning" of {_p}) to {_i}
set slot 8,18,26 of (metadata tag "sfh_warning" of {_p}) to red stained glass named "&r"
set slot 1,2,3,4,5,6,7,9,10,12,13,14,16,17,19,20,21,22,23,24,25 of (metadata tag "sfh_warning" of {_p}) to gray stained glass pane named "&r"
set slot 11 of (metadata tag "sfh_warning" of {_p}) to lime wool named "&aYes"
set slot 15 of (metadata tag "sfh_warning" of {_p}) to red wool named "&4No"
loop {sfh_files::%{_file}%::depend::*}:
Bukkit.getPluginManager().getPlugin(loop-value) is not set
add loop-value to {_dependecies::*}
if {sfh_files::%{_file}%::depend::*} is set:
set {_sign} to warped floor sign named "<##942121>&l&nI<##8C1D1D>&l&nN<##841818>&l&nF<##7B1414>&l&nO"
add "&cYou have missing dependencies!" to {_lore::*}
add "&c&cThe skript file requires:" to {_lore::*}
loop {sfh_files::%{_file}%::depend::*}:
if Bukkit.getPluginManager().getPlugin(loop-value) is not set:
add "<##de3428>-> %uncoloured loop-value%" to {_lore::*}
else:
add "<##09ff00>-> %uncoloured loop-value%" to {_lore::*}
set lore of {_sign} to {_lore::*}
set slot 13 of (metadata tag "sfh_warning" of {_p}) to {_sign}
open (metadata tag "sfh_warning" of {_p}) to {_p}
function sfh_openOptionsGUI(p: player, page: number=1):
set (metadata tag "sfh_options" of {_p}) to chest inventory with 4 rows named (mini message from "<gradient:##730F0F:##8c1616:##730F0F><bold>Options")
set {_i} to arrow named "&c<- Go back"
set tag "page" of (nbt of {_i}) to {_page}
set slot 27 of (metadata tag "sfh_options" of {_p}) to {_i}
set slot 0,8,35 of (metadata tag "sfh_options" of {_p}) to red stained glass named "&r"
set slot 1,2,3,4,5,6,7,9,17,18,26,28,29,30,31,32,33,34 of (metadata tag "sfh_options" of {_p}) to gray stained glass pane named "&r"
add "autoreload" to {_alloptions::*}
add "Sorting" to {_alloptions::*}
loop {_alloptions::*}:
add 1 to {_a}
if loop-value = "Sorting":
set {_i} to yellow wool named "<##09ff00>Sorting system"
set lore of {_i} to "<##ffff00>Current: %{sfh_options::%uuid of {_p}%::%loop-value%} ? "NORMAL"%"
else:
if {sfh_options::%uuid of {_p}%::%loop-value%} = true:
set {_i} to lime wool named "<##09ff00>%loop-value in strict proper case%"
set lore of {_i} to "<##09ff00>Status: ON"
else:
set {_i} to red wool named "<##ff0000>%loop-value in strict proper case%"
set lore of {_i} to "<##ff0000>Status: OFF"
set tag "Option" of (nbt of {_i}) to loop-value
set slot otherslot({_a}) of (metadata tag "sfh_options" of {_p}) to {_i}
open (metadata tag "sfh_options" of {_p}) to {_p}
on inventory click:
if event-inventory = (metadata tag "sfh_gui" of player):
cancel event
if index of event-slot = 2:
set {_page} to uncoloured name of event-inventory
replace all "Skript Files Hub [Page " and "]" in {_page} with ""
sfh_openOptionsGUI(player, ({_page} parsed as a number))
else if index of event-slot = 4:
set {_m} to text component from "{@prefix} &9Click here to send a message, click it to copy the discord link."
set click event of {_m} to new click event to copy "%{sfh_properties::discord} ? "https://discord.gg/cBCbZjhVJU"%" to clipboard
set hover event of {_m} to a new hover event showing "&9Click here for discord!"
send component {_m} to player
else if tag "GoPage" of (nbt of event-item) is set:
set {_page} to tag "GoPage" of (nbt of event-item)
sfh_openGUI(player, {_page})
if tag "SFH_ID" of (nbt of event-item) is set:
set {_vu} to {sfh_list::%tag "SFH_ID" of (nbt of event-item)%}
set {_page} to uncoloured name of event-inventory
replace all "Skript Files Hub [Page " and "]" in {_page} with ""
sfh_openWarningGUI(player, {_vu}, ({_page} parsed as a number))
else if event-inventory = (metadata tag "sfh_warning" of player):
cancel event
if index of event-slot = 11:
set {_ia0} to item in slot 0 of event-inventory
set {_file} to tag "file" of (nbt of {_ia0})
close player's inventory
if {_file} is not set:
send "{@prefix} ERROR: 512" to allOpPlayers()
stop
set {_url} to {sfh_files::%{_file}%::url}.toString()
sfh_getCode({_url}, player)
else if index of event-slot = 15:
set {_ia0} to item in slot 0 of event-inventory
set {_page} to tag "page" of (nbt of {_ia0})
if {_page} is not set:
send "{@prefix} ERROR: 512" to allOpPlayers()
stop
sfh_openGUI(player, ({_page} ? 1))
else if event-inventory = (metadata tag "sfh_options" of player):
cancel event
if index of event-slot = 27:
sfh_openGUI(player, (tag "page" of (nbt of event-item) ? 1))
stop
if tag "Option" of (nbt of event-item) is set:
if type of event-item is yellow wool:
sfh_sortingOption(player)
else if type of event-item is lime wool:
set {sfh_options::%uuid of player%::%tag "Option" of (nbt of event-item)%} to false
else:
set {sfh_options::%uuid of player%::%tag "Option" of (nbt of event-item)%} to true
set {_ia27} to item in slot 27 of event-inventory
sfh_openOptionsGUI(player, (tag "page" of (nbt of {_ia27}) ? 1))
local function sfh_sortingOption(p: player):
set {_sort} to {sfh_options::%uuid of {_p}%::sorting}
if {_sort} is not set:
set {sfh_options::%uuid of {_p}%::sorting} to "A-Z"
else if {_sort} is "a-z":
set {sfh_options::%uuid of {_p}%::sorting} to "Z-A"
else if {_sort} is "z-a":
delete {sfh_options::%uuid of {_p}%::sorting}
else:
delete {sfh_options::%uuid of {_p}%::sorting}
local function otherslot(n: integer) :: integer:
if {_n} >= 8:
add 11 to {_n}
else:
add 9 to {_n}
return {_n}
local function sfh_getItem(vu: string) :: item:
if {sfh_files::%{_vu}%::*} is not set:
set {_i} to paper
set {_i}'s name to "&4UNKNOWN FILE.sk"
set lore of {_i} to "<##29FFA9>Owner: &k???????%nl%<##b01e1e>E&kRR&r<##b01e1e>OR: 891"
return {_i}
stop
set {_i} to ({sfh_files::%{_vu}%::item} parsed as an itemtype) ? paper
set {_i} to {_i} with all flags hidden
set {_i}'s name to "<##63F2FF>&n%uncoloured {sfh_files::%{_vu}%::name}%.sk"
add "<##29FFA9>Owner: %uncoloured {sfh_files::%{_vu}%::owner}%" ? "<##29FFA9>Owner: &k???" to {_lore::*}
set {_l::*} to {sfh_files::%{_vu}%::desc} split by nl
loop {_l::*}:
add "&f%coloured loop-value%" to {_lore::*}
set lore of {_i} to {_lore::*}
set tag "SFH_ID" of (nbt of {_i}) to {sfh_files::%{_vu}%::num}
if {sfh_files::%{_vu}%::depend::*} is set:
set tag "Dependicies" of (nbt of {_i}) to true
if {_i} is not set:
send "{@prefix} ERROR: 512" to allOpPlayers()
stop
return {_i}
local function betterDoGetRequest(url: string) :: string:
set {_r} to HttpRequest.newBuilder().uri(new URI({_url})).GET().build()
set {_re} to HttpClient.newBuilder().build().send({_r}, HttpResponse.BodyHandlers.ofString())
return "%{_re}.body()%"
function sfh_getinfoelements(url1: string, n: number):
set {_url} to new URL({_url1})
if {_url} is not set:
send "{@prefix} ERROR: 512" to allOpPlayers()
stop
set {_path} to {_url}.getPath()
replace "/" in {_path} with "_"
set {_vu} to "%{_url}.getHost()%/\%{_path}%"
if {_vu} is not set:
send "{@prefix} ERROR: 512" to allOpPlayers()
stop
set {_check::url} to {_url}
set {_scanner} to new Scanner({_url}.openStream())
while {_scanner}.hasNextLine():
set {_line} to {_scanner}.nextLine()
if {_line} starts with "@ Info":
set {_wtu} to true
continue
else if {_line} starts with "@ Code":
stop loop
if {_wtu} is true:
{_line} is not "", " " or " "
{_line} doesn't start with "##"
set {_lv} to deleteFirstSpaces({_line})
if {_lv} starts with "##":
continue
if {_desccheck} is set:
if all:
{_line} is not "", " " or " "
{_lv} starts with "-"
{_descn} <= 10
then:
replace "- " in {_lv} with ""
add {_lv} to {_desc::*}
add 1 to {_descn}
continue
else:
set {_check::desc} to join {_desc::*} by nl
delete {_desccheck}
if {_dependcheck} is true:
if all:
{_line} is not "", " " or " "
{_lv} starts with "-"
then:
replace "- " in {_lv} with ""
add {_lv} to {_depend::*}
continue
else:
set {_ocheck::depend::*} to {_depend::*}
delete {_depend::*}
if {_lv} starts with "Name: ":
replace "Name: " in {_lv} with ""
replace all " " and " " in {_lv} with "_"
set {_check::name} to {_lv}
else if {_lv} starts with "Owner: ":
replace "Owner: " in {_lv} with ""
set {_check::owner} to {_lv}
else if {_lv} starts with "Description:" or "Desc:":
set {_desccheck} to "description"
set {_descn} to 1
continue
else if {_lv} starts with "Version: ":
replace "Version: " in {_lv} with ""
set {_check::version} to {_lv}
else if {_lv} starts with "Dependencies:":
set {_dependcheck} to true
continue
else if {_lv} starts with "Item: ":
replace "Item: " in {_lv} with ""
set {_check::item} to {_lv}
size of {_check::*} = 6
loop {_check::*}:
set {sfh_files::%{_vu}%::%loop-index%} to loop-value
set {sfh_alphabetorder::%{_check::name}%} to {_n}
set {sfh_list::%{_n}%} to {_vu}
set {sfh_files::%{_vu}%::num} to {_n}
{_ocheck::depend::*} is set
set {sfh_files::%{_vu}%::depend::*} to {_ocheck::depend::*}
local function sfh_getCode(url1: string, p: player):
set {_timetooken} to now
set {_url} to new URL({_url1})
if {_url} is not set:
send "{@prefix} ERROR: 512" to allOpPlayers()
stop
set {_path} to {_url}.getPath()
replace "/" in {_path} with "_"
set {_vu} to "%{_url}.getHost()%/\%{_path}%"
if {_vu} is not set:
send "{@prefix} ERROR: 512" to allOpPlayers()
stop
set {_filen} to {sfh_files::%{_vu}%::name}
set {_file} to "{@path}%{_filen}%.sk"
if (new File({_file})).exists() = false:
createFile({_file})
else:
send "{@prefix} One of your files can't be created nor written! ERROR: 126" to allOpPlayers()
stop
set {_writer} to new FileWriter({_file})
set {_scanner} to new Scanner({_url}.openStream())
while {_scanner}.hasNextLine():
set {_line} to {_scanner}.nextLine()
if {_line} starts with "@ Code":
set {_wtu} to true
continue
if {_wtu} is true:
{_writer}.write("%{_line}%%nl%")
{_writer}.close()
if {sfh_options::%uuid of {_p}%::autoreload} is true:
set {_skpath} to {_file}
replace all "{@auto reloading path}" in {_skpath} with ""
reload script {_skpath}
send "{@prefix} Your file has been created and reloaded." to {_p}
else:
send "{@prefix} Your file has been created." to {_p}
set {_time} to difference between {_timetooken} and now
send "{@prefix} It took %{_time}% to get the file." to allOpPlayers()
stop
local function createFile(filepath: string):
set {_file} to new File("%{_filepath}%")
{_file}.createNewFile()
local function deleteFirstSpaces(t: string) :: string:
set {_t::*} to {_t} split by ""
loop {_t::*}:
# add 1 to {_a}
if loop-value is "" or " " or " ":
delete {_t::%loop-index%}
else:
stop loop
return join {_t::*} by ""