code_language.skript:
#=======================Made by jmqr2=========================#
#CONFIG
options:
kills variable: {kills::*}
deaths variable: {deaths::*}
blocksbroken variable: {blocksmined::*}
board size: 10
#CODE
function leaderboardReload(n: text):
if {_n} is "Deaths":
set {_l::*} to sorted {@deaths variable} from highest to lowest with format "@index&7 - @value Deaths"
if {_n} is "Kills":
set {_l::*} to sorted {@kills variable} from highest to lowest with format "@index&7 - @value Kills"
if {_n} is "Blocks Mines":
set {_l::*} to sorted {@blocksmined variable} from highest to lowest with format "@index&7 - @value Blocks Mined"
loop {_l::*}:
if loop-index parsed as int is more than {@board size}:
stop loop
set {_1::*} to loop-value split at " "
set {_1::1} to "%uncoloured {_1::1} parsed as offlineplayer%&7"
set {_l::%loop-index%} to "%{_1::*}%"
replace all "," and "and " with "" in {_l::%loop-index%}
loop {leaderstats.list::*}:
if {_n} is "Kills":
loop-index contains {_n}
loop {_l::*}:
if loop-index-2 parsed as int is more than {@board size}:
stop loop
if loop-index-2 parsed as int is more than 10:
stop loop
if loop-index-2 is "1":
set {_45} to "&6"
else if loop-index-2 is "2":
set {_45} to "&7"
else if loop-index-2 is "3":
set {_45} to "&4"
else:
set {_45} to "&c"
set line (loop-index-2 parsed as int + 1) of loop-value-1 to "%{_45}%%loop-index-2%&7 - %{_45}%%loop-value-2%"
command /beestats [<text>] [<text>] [<text>]:
permission: beestats.*
trigger:
if arg-1 is "create":
if arg-3 is not set:
send "&c/beestats create (leaderboard type) (name)"
stop
if arg-3 contains " ":
send "&c/beestats create (leaderboard type) (name)"
stop
loop {leaderstats.list::*}:
if loop-index contains " %arg-3%":
send "&cThat name is already in use."
stop
if arg-2 contains "deaths":
set {_1} to "Deaths"
else if arg-2 contains "kill":
set {_1} to "Kills"
else if arg-2 contains "blocksmined":
set {_1} to "Blocks Mined"
else:
send "&c/beestats create (kills | deaths | blocksmined) (name)"
stop
create new holo with lines "&7-----------< &cTop %{_1}% &7>-----------" at location 1 above player and store in {leaderstats.list::%{_1}% - %arg-3%}
send "&bSuccessfully Created %{_1}% &bHologram named ""%arg-3%&b"""
leaderboardReload({_1})
set {leaderstats.list2::%{_1}% - %arg-3%} to location 1 above player
else if arg-1 is "list":
set {_1} to arg-2 parsed as integer
if {_1} is not set:
set {_1} to 1
set {_2} to rounded up (size of {leaderstats.list::*} / 10)
if {_2} is less than {_1}:
send "&7BeeStats List page number &c%{_1}% &7doesnt exist!"
stop
send "&7-----------< &cBeeStats List %{_1}% &7>-----------"
set {_4} to {_1} * 10
loop {holostats.list::*}:
add 1 to {_3}
if {_3} is between ({_4} - 9) and {_4}:
set {_5} to loop-index
replace all "Deaths - ", "Kills - " and "Blocks Mined - " with "" in {_5}
set {_6} to loop-index in proper case
send formatted "&7%{_6}% <cmd:/beestats delete %{_5}%>&c[Delete]<reset> &b[%location of loop-value%&b, world: %world of (location of loop-value)%]"
if {_2} is not less than ({_1} + 1):
send "&7Command &c/beestats list %{_1} + 1%&7 for next page."
else if arg-1 is "delete":
if arg-2 is set:
loop {holostats.list::*}:
if loop-index contains " %arg-2%":
set {_1} to loop-index
if {_1} is not set:
send "&cThat BeeStats Hologram does not exist!"
stop
delete holo {holostats.list::%{_1}%}
delete {holostats.list::%{_1}%}
delete {holostats.list2::%{_1}%}
send "&7Deleted hologram &7""&c%arg-2%&7"""
else if arg-1 is "reload":
leaderboardReload("Blocks Mined")
leaderboardReload("Kills")
leaderboardReload("Deaths")
send "&bReloaded all BeeStats Leaderboards" to player
send "Reloaded all BeeStats Leaderboards | %time% | This is automatically happens every minute." to console
else if arg-1 is "wipe":
loop {leaderstats.list::*}:
set {_1} to 2
loop 10 times:
delete line {_1} of loop-value-1
send "&cWiped all stats from every BeeStats leaderboard!"
else:
send "&7-----------< &cBeeStats Help &7>-----------%nl%&c/beestats Create (kills | deaths | blocksmined) (name) &7-> create a new leaderboard%nl%&c/beestats List &7-> Get a list of all BeeStats leaderboards%nl%&c/beetats Delete (name)&7 -> Delete a leaderboard%nl%&c/beestats reload &7-> Reload all leaderboards (this happens automatically)%nl%&c/beestats Wipe &7-> Wipe all leaderboards%nl%&7-----------< &cBeeStats Help &7>-----------"
every 1 minute:
console command "/beestats reload"
on skript start:
loop {leaderstats.list2::*}:
set {_5} and {_6} to loop-index
replace all "Deaths", "Kills" and "Blocks Mined" with "" in {_5}
replace all {_5} with "" in {_6}
create new holo with lines "&7-----------< &cTop %{_6}% &7>-----------" at location of loop-value and store in {leaderstats.list::%loop-index%}
console command "/beestats reload"