aboutsummaryrefslogtreecommitdiff
path: root/features/stat_next_to_name
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2021-11-30 23:28:02 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2021-11-30 23:28:02 +0800
commit71ae701c364f586c34ae2d1e5f82e4df89e1d851 (patch)
tree8ed41d1b9fbdf72bbf256cb60d83a82adf8446b6 /features/stat_next_to_name
parent5f481b984dfeb8ec6d6eb1762928726d728e775d (diff)
downloadSoopyV2-71ae701c364f586c34ae2d1e5f82e4df89e1d851.tar.gz
SoopyV2-71ae701c364f586c34ae2d1e5f82e4df89e1d851.tar.bz2
SoopyV2-71ae701c364f586c34ae2d1e5f82e4df89e1d851.zip
Allow for dynamic updating of module code in the fly
Diffstat (limited to 'features/stat_next_to_name')
-rw-r--r--features/stat_next_to_name/index.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/features/stat_next_to_name/index.js b/features/stat_next_to_name/index.js
index 59a84f7..586c4ba 100644
--- a/features/stat_next_to_name/index.js
+++ b/features/stat_next_to_name/index.js
@@ -23,6 +23,7 @@ class StatNextToName extends Feature {
soopyV2Server.onPlayerStatsLoaded = (stats)=>{this.playerStatsLoaded.call(this, stats)}
this.registerStep(false, 5, this.loadPlayerStatsTick)
+ this.registerEvent("worldLoad", this.worldLoad)
}
loadPlayerStatsTick(){
@@ -35,6 +36,7 @@ class StatNextToName extends Feature {
return
}
if(this.loadingStats.includes(player.getUUID().toString().replace(/-/g, ""))) return
+ if(Player.getUUID().replace(/-/g, "").toString().substr(12, 1) !== "4") return
let dist = Math.pow(player.getX() - Player.getX(), 2) + Math.pow(player.getY() - Player.getY(), 2) + Math.pow(player.getZ() - Player.getZ(), 2)
if(dist < nearestDistance){
@@ -48,6 +50,15 @@ class StatNextToName extends Feature {
}
}
+ worldLoad(){
+ let playerStats = this.userStats[Player.getUUID().toString().replace(/-/g, "")]
+ this.userStats = {}
+ this.loadingStats = []
+ if(playerStats){
+ this.userStats[Player.getUUID().toString().replace(/-/g, "")] = playerStats
+ }
+ }
+
updatePlayerNametag(player){
let stats = this.userStats[player.getUUID().toString().replace(/-/g, "")]