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.
# ###################################################################
# Zabrid's YAML Manager
# Author(s): {zabrid}#3433
# Version: 1.2.1
# Date 5/3/22
# Required Plugins:
# - Skript
# - Skript-YAML
# Functions:
# - zdata_server_setvalue(value: text, chicken: text, save: boolean): - Set server related data
# - zdata_server_delvalue(value: text, save: boolean): - Delete 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_delvalue(p: player, value: text, save: boolean): - Delete 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
# ###################################################################
# Zabrid's YAML Manager
# Source Code
# Feel free to change anything below this point.
# Although, beware you might break something!
# ###################################################################
# Loading YAMLs
on skript load:
set {yaml-manager-no-join} to true
wait 15 seconds
delete {yaml-manager-no-join}
load yaml "{@directory}/ServerData/data.yml" as "{@directory}/ServerData/data.yml"
on load:
wait 1 tick
if {yaml-manager-no-join} is set:
stop
load yaml "{@directory}/ServerData/data.yml" as "{@directory}/ServerData/data.yml"
on unload:
save yaml "{@directory}/ServerData/data.yml"
every {@auto-save-speed} minutes:
if {@auto-save-announcement-boolean} is true:
set {_time} to now
if {@auto-save-announcement-ops-only} is false:
broadcast {@auto-save-announcement-starting-message}
else:
send {@auto-save-announcement-starting-message} to console
loop all players:
loop-player is op
send {@auto-save-announcement-starting-message} to loop-player
save yaml "{@directory}/ServerData/data.yml"
set {_count} to 0
loop all players:
save yaml "{@directory}/PlayerData/%uuid of loop-player%.yml"
add 1 to {_count}
if {_count} is greater than 50:
set {_count} to 0
wait 1 tick
if {@auto-save-announcement-boolean} is true:
set {_time} to difference between {_time} and now
if {@auto-save-announcement-ops-only} is false:
broadcast {@auto-save-announcement-ended-message}
else:
send {@auto-save-announcement-ended-message} to console
loop all players:
loop-player is op
send {@auto-save-announcement-ended-message} to loop-player
on connect:
if {yaml-manager-no-join} is true:
kick the player due to {@still-loading-message}
else:
load yaml "{@directory}/PlayerData/%uuid of player%.yml" as "{@directory}/PlayerData/%uuid of player%.yml"
on disconnect:
save yaml "{@directory}/PlayerData/%uuid of player%.yml"
# Server Data Management
function zdata_server_setvalue(value: text, chicken: text, save: boolean):
set yaml value {_value} from "{@directory}/ServerData/data.yml" to {_chicken}
if {@do-not-save-numbers-equal-less-than-0} is true:
set {_chicken} to {_chicken} parsed as number
if {_chicken} is a number:
if {_chicken} is less than or equal to 0:
delete yaml value {_value} from "{@directory}/ServerData/data.yml"
if {_save} is true:
save yaml "{@directory}/ServerData/data.yml"
function zdata_server_delvalue(value: text, save: boolean):
delete yaml value {_value} from "{@directory}/ServerData/data.yml"
if {_save} is true:
save yaml "{@directory}/ServerData/data.yml"
function zdata_server_getvalue(value: text) :: text:
set {_return} to yaml value {_value} from "{@directory}/ServerData/data.yml"
return "%{_return}%"
function zdata_server_save():
save yaml "{@directory}/ServerData/data.yml"
# Player Data Management
function zdata_player_setvalue(p: offline player, value: text, chicken: text, save: boolean):
set {_uuid} to uuid of {_p}
if {_p} is offline:
load yaml "{@directory}/PlayerData/%{_uuid}%.yml" as "{@directory}/PlayerData/%{_uuid}%.yml"
set yaml value {_value} from "{@directory}/PlayerData/%{_uuid}%.yml" to {_chicken}
if {@do-not-save-numbers-equal-less-than-0} is true:
set {_chicken} to {_chicken} parsed as number
if {_chicken} is a number:
if {_chicken} is less than or equal to 0:
delete yaml value {_value} from "{@directory}/PlayerData/%{_uuid}%.yml"
if {_p} is offline:
zdata_player_unloadandsave({_p})
stop
if {_save} is true:
save yaml "{@directory}/PlayerData/%{_uuid}%.yml"
function zdata_player_delvalue(p: offline player, value: text, save: boolean):
set {_uuid} to uuid of {_p}
delete yaml value {_value} from "{@directory}/PlayerData/%{_uuid}%.yml"
if {_save} is true:
save yaml "{@directory}/PlayerData/%{_uuid}%.yml"
function zdata_player_getvalue(p: offline player, value: text) :: text:
set {_uuid} to uuid of {_p}
if {_p} is offline:
load yaml "{@directory}/PlayerData/%{_uuid}%.yml" as "{@directory}/PlayerData/%{_uuid}%.yml"
set {_return} to yaml value {_value} from "{@directory}/PlayerData/%{_uuid}%.yml"
if {_p} is offline:
save yaml "{@directory}/PlayerData/%{_uuid}%.yml"
zdata_player_unload({_p})
return "%{_return}%"
function zdata_player_save(p: player):
set {_uuid} to uuid of {_p}
save yaml "{@directory}/PlayerData/%{_uuid}%.yml"
# Don't really recommend using these functions, they're mainly for running code after another function has already concluded.
function zdata_player_unload(p: offline player):
set {_uuid} to uuid of {_p}
wait 1 tick
{_p} is offline
unload yaml "{@directory}/PlayerData/%{_uuid}%.yml"
function zdata_player_unloadandsave(p: offline player):
set {_uuid} to uuid of {_p}
wait 1 tick
{_p} is offline
save yaml "{@directory}/PlayerData/%{_uuid}%.yml"
unload yaml "{@directory}/PlayerData/%{_uuid}%.yml"
# Leaderboard Management
function zdata_player_gettop(value: text) :: texts:
loop all offline players:
set {_uuid} to uuid of loop-value
if loop-value is offline:
load yaml "{@directory}/PlayerData/%{_uuid}%.yml" as "{@directory}/PlayerData/%{_uuid}%.yml"
set {_list::%{_uuid}%} to yaml value {_value} from "{@directory}/PlayerData/%{_uuid}%.yml"
zdata_player_unload({_p})
else:
set {_list::%{_uuid}%} to yaml value {_value} from "{@directory}/PlayerData/%{_uuid}%.yml"
loop {_list::*}:
add 1 to {_size}
if {_low.to.high.list::%loop-value%} is not set:
set {_low.to.high.list::%loop-value%} to loop-index
else:
set {_n} to 0
loop {_size} times:
set {_n} to {_n}+1
{_low.to.high.list::%loop-value-1%.%{_n}%} is not set
set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
stop loop
set {_n} to size of {_low.to.high.list::*}
loop {_low.to.high.list::*}:
set {_high.to.low.list::%{_n}%} to loop-value
set {_n} to {_n}-1
return {_high.to.low.list::*}