Files
BoxHeatScoreboard.sk
Code
1 84
BoxHeatScoreboard.sk
# BoxHeat Scoreboard
# Place in: plugins/Skript/scripts/
# Reload with: /sk reload BoxHeatScoreboard
options:
title: &c&lBoxHeat
arrow: &7»
header-color: &e
value-color: &b
update-interval: 2 seconds
# ── Stat Tracking ──────────────────────────────────────────
on join:
add 1 to {boxheat.joins}
wait 1 tick
call updateScoreboard(player)
on quit:
clear the sidebar of player
on break:
add 1 to {boxheat.blocks::%player's uuid%}
on death of player:
add 1 to {boxheat.deaths::%victim's uuid%}
if attacker is a player:
add 1 to {boxheat.kills::%attacker's uuid%}
# ── Scoreboard Updater ─────────────────────────────────────
every {@update-interval}:
loop all players:
call updateScoreboard(loop-player)
# ── Scoreboard Function ────────────────────────────────────
function updateScoreboard(p: player):
# Gather player stats
set {_name} to {_p}'s display name
set {_kills} to {boxheat.kills::%{_p}'s uuid%} ? 0
set {_deaths} to {boxheat.deaths::%{_p}'s uuid%} ? 0
set {_blocks} to {boxheat.blocks::%{_p}'s uuid%} ? 0
set {_joins} to {boxheat.joins} ? 0
set {_online} to size of all players
set {_max} to the max players
# Determine rank
set {_rank} to "default"
if {_p} has permission "rank.owner":
set {_rank} to "&4Owner"
else if {_p} has permission "rank.admin":
set {_rank} to "&cAdmin"
else if {_p} has permission "rank.mod":
set {_rank} to "&bMod"
else if {_p} has permission "rank.vip":
set {_rank} to "&6VIP"
# Build blocks display
if {_blocks} > 0:
set {_blocksdisplay} to "&b%{_blocks}%"
else:
set {_blocksdisplay} to "&7<none>"
# Set sidebar title
set title of sidebar of {_p} to "{@title}"
# Player section
set line 14 of sidebar of {_p} to "{@header-color}&lPlayer"
set line 13 of sidebar of {_p} to "{@arrow} &fName: {@value-color}%{_name}%"
set line 12 of sidebar of {_p} to "{@arrow} &fRank: {@value-color}%{_rank}%"
set line 11 of sidebar of {_p} to "{@arrow} &fBlocks Mined: %{_blocksdisplay}%"
set line 10 of sidebar of {_p} to "{@arrow} &fKills: {@value-color}%{_kills}%"
set line 9 of sidebar of {_p} to "{@arrow} &fDeaths: {@value-color}%{_deaths}%"
# Spacer
set line 8 of sidebar of {_p} to " "
# Server section
set line 7 of sidebar of {_p} to "{@header-color}&lServer"
set line 6 of sidebar of {_p} to "{@arrow} &fOnline Players: {@value-color}%{_online}% &f/ {@value-color}%{_max}%"
set line 5 of sidebar of {_p} to "{@arrow} &fJoins: {@value-color}%{_joins}%"
set line 4 of sidebar of {_p} to " "