THIS RESOURCE IS TO HELP SKRIPT DEVELOPERS MANAGE THEIR DATA. IT IS NOT FOR YOUR AVERAGE SERVER OWNER!
Have you ever had problems with skript's built-in data storage system? Have you ever wanted to use Skript-YAML but didn't know how? Well then, this script has you covered!
This script automatically sort all of your data into separate folders (per user) to ensure maximum server performance at all times. Not only that, it can also store server-side data (e.i unique players).
Config:
Example:
Required Plugins:
Support Discord: https://discord.gg/vMuWFWXJVy
Have you ever had problems with skript's built-in data storage system? Have you ever wanted to use Skript-YAML but didn't know how? Well then, this script has you covered!
This script automatically sort all of your data into separate folders (per user) to ensure maximum server performance at all times. Not only that, it can also store server-side data (e.i unique players).
Config:
Code:
# ###################################################################
# Zabrid's YAML Manager
# Author(s): {zabrid}#3433
# Required Plugins:
# - Skript
# - Skript-YAML
# Functions:
# - zdata_server_setvalue(value: text, chicken: text, save: boolean): - Set server related data
# - zdata_server_getvalue(value: text) :: text: - Get server related data
# - zdata_server_save(): - Save all server related data
# - zdata_player_setvalue(p: player, value: text, chicken: text, save: boolean): - Set data for a specific player
# - zdata_player_getvalue(p: player, value: text) :: text: - Get data from a specific player
# - zdata_player_save(p: player): - Save a specific player's data
# - zdata_player_gettop(value: text) :: texts: - Get a sorted list from high to low (Player data, duh)
# Values Cheat Sheet:
# - chicken = What you're setting the value to
# - value = The name of the variable you're setting.
# - Values can be split into different nodes by putting a "." (ex: "stats.blocks-placed.cactus")
# - save = Do you want to save the data immediently?
# ###################################################################
# Configuration
options:
# How often the server will auto-save YAML data
auto-save-speed: 5
# Whether or not the server will announce YAML data saving
auto-save-announcement-boolean: true
# Only send the YAML saving announcement message to server ops
auto-save-announcement-ops-only: true
# YAML data save message
auto-save-announcement-starting-message: "&8[&cData&8] &7Saving all player and server data..."
auto-save-announcement-ended-message: "&8[&cData&8] &7Successfully saved all player and server data. &8(&c%{_time}%&8)"
# Still Loading Data Kick Message
still-loading-message: "&8&m %nl%%nl%&7You cannot join at this time.%nl%&7Data from the server is still being loaded.%nl%%nl%&cPlease try again in ~15 seconds.%nl%%nl%&8&m "
# Do you want to automatically delete a YAML value if it is less than or equal to 0? (Only for numbers and integers)
do-not-save-numbers-equal-less-than-0: false
# The folder where you want all data to go to.
# WARNING: IF YOU CHANGE THIS DATA DOES NOT TRANSFER
directory: plugins/ZabridYamlManager
Example:
Code:
# This is an example on how to use Zabrid's YAML Manager
# This example shows how you could track a player's kills and deaths, aswell as make a leaderboard
on death:
victim is a player
set {_deaths} to zdata_player_getvalue(victim, "kill-tracker.deaths") parsed as integer # Retrieving the amount of deaths the victim has
add 1 to {_deaths} # Adding 1 to the amount of deaths the victim has
zdata_player_setvalue(victim, "kill-tracker.deaths", "%{_deaths}%", true) # Setting the amount of deaths the victim has. This data will be saved instantly.
attacker is a player
set {_kills} to zdata_player_getvalue(victim, "kill-tracker.kills") parsed as integer # Retrieving the amount of kills the attacker has
add 1 to {_kills} # Adding 1 to the amount of kills the attacker has
zdata_player_setvalue(victim, "kill-tracker.deaths", "%{_deaths}%", true) # Setting the amount of kills the attacker has. This data will be saved instantly.
on join:
set {_deaths} to zdata_player_getvalue(player, "kill-tracker.deaths")
if "%{_deaths}%" is "<none>": # Skript bug, means you have to do it like this
zdata_player_setvalue(player, "kill-tracker.deaths", "0", false) # I did not save here because I will save later in the event
set {_kills} to zdata_player_getvalue(player, "kill-tracker.kills")
if "%{_kills}%" is "<none>":
zdata_player_setvalue(player, "kill-tracker.kills", "0", false) # I did not save here because I will save later in the event
zdata_player_save(player) # Saves all of the players YAML data
command /kills [<offline player>]:
trigger:
set {_p} to arg 1 ? player
set {_kills} to zdata_player_getvalue({_p}, "kill-tracker.kills")
if {_kills} is set:
send "&a%{_p}% has killed &n%{_kills}%&a people."
else:
send "&cThis player does not have any Kills data stored."
command /deaths [<offline player>]:
trigger:
set {_p} to arg 1 ? player
set {_deaths} to zdata_player_getvalue({_p}, "kill-tracker.deaths")
if {_deaths} is set:
send "&c%{_p}% has died &n%{_deaths}%&c times."
else:
send "&cThis player does not have any Deaths data stored."
# This is how you make a leaderboard with Zabrid's YAML Manager
command /killstop:
trigger:
set {_leaderboard::*} to zdata_player_gettop("kill-tracker.kills")
send "%{_leaderboard::1} parsed as offline player% &7is the top killer."
send ""
send "&aTop 10 Killers on the server!"
send "&8-> &7Tracking &d%size of {_leaderboard::*}%&7 players"
send ""
loop {_leaderboard::*}:
if loop-index parsed as integer is greater than 10: #This means only the top 10 most kills will show up
stop
# loop-value = the UUID of the player
# loop-index = The player's position. This value is text by default, so parse it if you need to do math
set {_value} to zdata_player_getvalue(loop-value parsed as offline player, "kill-tracker.kills") # loop-value saved as the uuid of the player, so to get the name you need to parse as offline player
send "&7 %loop-index%. &a%loop-value parsed as offline player% &8- &7%{_value}%"
send ""
Required Plugins:
Code:
Skript
Skript-YAML
Support Discord: https://discord.gg/vMuWFWXJVy