Files
stats.sk
Code
1 45
stats.sk
# Money display requires Vault and a Vault-compatible economy plugin.
# The floating text display uses SkBee and requires Minecraft 1.19.4 or newer.
on join:
set {stats.session::%uuid of player%} to now
on quit:
if {stats.session::%uuid of player%} is set:
add difference between {stats.session::%uuid of player%} and now to {stats.playtime::%uuid of player%}
delete {stats.session::%uuid of player%}
on death of player:
add 1 to {stats.deaths::%uuid of victim%}
if attacker is a player:
add 1 to {stats.kills::%uuid of attacker%}
command /stats:
trigger:
set {_id} to uuid of player
set {_location} to location 2 blocks in front of player
add 1.5 to y-coordinate of {_location}
spawn a text display at {_location}
set {_display} to last spawned entity
set billboard of {_display} to center
loop 5 times:
set {_kills} to {stats.kills::%{_id}%}
set {_deaths} to {stats.deaths::%{_id}%}
set {_playtime} to {stats.playtime::%{_id}%}
if {_kills} is not set:
set {_kills} to 0
if {_deaths} is not set:
set {_deaths} to 0
if {_playtime} is not set:
set {_playtime} to 0 seconds
if {stats.session::%{_id}%} is set:
add difference between {stats.session::%{_id}%} and now to {_playtime}
set {_money} to player's balance
set {_displayText} to colored "&8╭────────────────────╮%nl%&b☻ &f%player%'s &bStats%nl%&8├────────────────────┤%nl%&c⚔ &fKills: &c%{_kills}%%nl%&7☠ &fDeaths: &7%{_deaths}%%nl%&a$ &fMoney: &a%{_money}%%nl%&e◷ &fPlaytime: &e%{_playtime}%%nl%&8╰────────────────────╯"
set text of {_display} to {_displayText}
wait 1 second
delete {_display}