diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/dataLoader/index.js | 2 | ||||
-rw-r--r-- | features/events/index.js | 27 | ||||
-rw-r--r-- | features/hud/index.js | 3 | ||||
-rw-r--r-- | features/soopyGui/GuiPage.js | 18 | ||||
-rw-r--r-- | features/stat_next_to_name/index.js | 11 |
5 files changed, 47 insertions, 14 deletions
diff --git a/features/dataLoader/index.js b/features/dataLoader/index.js index 41f0c61..43b0f7a 100644 --- a/features/dataLoader/index.js +++ b/features/dataLoader/index.js @@ -46,7 +46,7 @@ class DataLoader extends Feature { } loadApiData(type, soopyServer){ - while(this.FeatureManager.features["globalSettings"] === undefined){ + while(this.FeatureManager.features["globalSettings"] === undefined || this.FeatureManager.features["globalSettings"].class.apiKeySetting === undefined){ Thread.sleep(100) } let key = this.FeatureManager.features["globalSettings"].class.apiKeySetting.getValue() diff --git a/features/events/index.js b/features/events/index.js index 80ba200..5586503 100644 --- a/features/events/index.js +++ b/features/events/index.js @@ -41,7 +41,8 @@ class Events extends Feature { .requires(this.burrialWaypointsEnabled) .editTempText("&6Update&7> &f100s")) this.hudElements.push(this.updateTimer) - + + this.registerEvent("worldLoad", this.worldLoad) this.registerEvent("spawnParticle", this.spawnParticle) this.registerEvent("renderWorld", this.renderWorld) @@ -75,14 +76,7 @@ class Events extends Feature { }) } if(this.showingWaypoints){ - let sorted = [...this.burrialData.locations] - sorted.sort((a,b)=>{ - let aDist = calculateDistanceQuick([Player.getX(),Player.getY(),Player.getZ()],[a.x+0.5,a.y+2.5,a.z+0.5]) - let bDist = calculateDistanceQuick([Player.getX(),Player.getY(),Player.getZ()],[b.x+0.5,b.y+2.5,b.z+0.5]) - - return bDist-aDist - }) - sorted.forEach((loc,i)=>{ + this.burrialData.locations.forEach((loc,i)=>{ let typeReplace = [ "Start", @@ -119,6 +113,17 @@ class Events extends Feature { } } + sortBurrialLocations(){ + let sorted = [...this.burrialData.locations] + sorted.sort((a,b)=>{ + let aDist = calculateDistanceQuick([Player.getX(),Player.getY(),Player.getZ()],[a.x+0.5,a.y+2.5,a.z+0.5]) + let bDist = calculateDistanceQuick([Player.getX(),Player.getY(),Player.getZ()],[b.x+0.5,b.y+2.5,b.z+0.5]) + + return bDist-aDist + }) + this.burrialData.locations = sorted + } + step(){ hasDianaShovle = false @@ -160,6 +165,7 @@ class Events extends Feature { }).start() } } + this.sortBurrialLocations() } worldLoad(){ @@ -234,6 +240,7 @@ class Events extends Feature { }) this.burrialData.locations = newLocs + this.sortBurrialLocations() this.updateBurrialPath() } @@ -376,7 +383,7 @@ class Events extends Feature { return false }) if(this.burrialData.historicalLocations.length > 10) this.burrialData.historicalLocations.pop() - this.lastPathCords.shift() + if(this.lastPathCords) this.lastPathCords.shift() new Thread(()=>{ this.updateBurrialPath() }).start() diff --git a/features/hud/index.js b/features/hud/index.js index e8dc604..704c954 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -9,8 +9,6 @@ import HudTextElement from "./HudTextElement"; class Hud extends Feature { constructor() { super() - - this.initVariables() } initVariables(){ @@ -58,6 +56,7 @@ class Hud extends Feature { } onEnable(){ + this.initVariables() this.numberUtils = require("../../utils/numberUtils.js") diff --git a/features/soopyGui/GuiPage.js b/features/soopyGui/GuiPage.js index 13778fe..fb93bbe 100644 --- a/features/soopyGui/GuiPage.js +++ b/features/soopyGui/GuiPage.js @@ -5,15 +5,31 @@ class GuiPage{ this.currentPageId = 0; this.priority = priority - this.soopyGui = require('./index.js').class; + this.soopyGui = undefined; + new Thread(()=>{ + while(global.soopyv2featuremanagerthing.features["soopyGui"] === undefined){ + Thread.sleep(100) + } + + this.soopyGui = global.soopyv2featuremanagerthing.features["soopyGui"].class; + + if(this.finalisedLoading){ + this.finaliseLoading() + } + }).start() this.name = "" this.pages = {} this.showBackButton = true + this.finalisedLoading = false } finaliseLoading(){ + if(!this.soopyGui){ + this.finalisedLoading = true + return + } this.soopyGui.addCategory(this); } 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, "")] |