aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--features/hud/HudTextElement.js1
-rw-r--r--features/settings/locationSettingHolder.js20
-rw-r--r--features/settings/settingThings/location.js4
-rw-r--r--features/slayers/index.js4
4 files changed, 19 insertions, 10 deletions
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js
index 834ef28..d6440aa 100644
--- a/features/hud/HudTextElement.js
+++ b/features/hud/HudTextElement.js
@@ -23,6 +23,7 @@ class HudTextElement {
delete() {
this.renderElm.stopRender()
+ if (this.locationSetting) this.locationSetting.delete()
}
setBaseEditWidth(width) {
diff --git a/features/settings/locationSettingHolder.js b/features/settings/locationSettingHolder.js
index 14256d3..af6f507 100644
--- a/features/settings/locationSettingHolder.js
+++ b/features/settings/locationSettingHolder.js
@@ -1,21 +1,25 @@
class LocationSettingHolder {
constructor() {
- this.data = [];
+ this.data = new Set();
}
- addLocationSetting(setting){
- this.data.push(setting)
+ addLocationSetting(setting) {
+ this.data.add(setting)
}
- getData(){
- return this.data
+ removeLocationSetting(setting) {
+ this.data.delete(setting)
+ }
+
+ getData() {
+ return [...this.data]
}
}
-if(!global.LocationSettingHolder){
+if (!global.LocationSettingHolder) {
global.LocationSettingHolder = new LocationSettingHolder();
-
- register("gameUnload", ()=>{
+
+ register("gameUnload", () => {
global.LocationSettingHolder = undefined
})
}
diff --git a/features/settings/settingThings/location.js b/features/settings/settingThings/location.js
index 9cd13af..c9587eb 100644
--- a/features/settings/settingThings/location.js
+++ b/features/settings/settingThings/location.js
@@ -146,6 +146,10 @@ class LocationSetting extends ButtonSetting {
return this
}
+ delete() {
+ locationSettingHolder.removeLocationSetting(this)
+ }
+
_updateValue() {
this.setValue([this.x, this.y, this.scale, this.shadowType])
if (this.onChange) this.onChange()
diff --git a/features/slayers/index.js b/features/slayers/index.js
index 6c40115..c83e924 100644
--- a/features/slayers/index.js
+++ b/features/slayers/index.js
@@ -35,7 +35,7 @@ class Slayers extends Feature {
this.slayerXpElement = new HudTextElement()
.setText("&6Slayer&7> &fLoading...")
.setToggleSetting(this.slayerXpGuiElement)
- .setLocationSetting(new LocationSetting("Slayer Xp Location", "Allows you to edit the location of you current slayer xp", "slayer_xp_location", this, [10, 50, 1, 1]).requires(this.slayerXpGuiElement).editTempText("&aEnderman&7> &d&l2,147,483,647 XP").contributor("EmeraldMerchant"));
+ .setLocationSetting(new LocationSetting("Slayer Xp Location", "Allows you to edit the location of you current slayer xp", "slayer_xp_location", this, [10, 50, 1, 1]).requires(this.slayerXpGuiElement).editTempText("&6Enderman&7> &d&l2,147,483,647 XP").contributor("EmeraldMerchant"));
this.hudElements.push(this.slayerXpElement);
this.rcmDaeAxeSupport = new ToggleSetting("Eman Hyp hits before Dae axe swapping", "This will tell u how many clicks with hyp is needed before swapping to dae axe", true, "eman_rcm_support", this).requires(this.emanHpGuiElement).contributor("EmeraldMerchant");
@@ -294,7 +294,7 @@ class Slayers extends Feature {
this.todoE2 = [];
if (this.slayerXpGuiElement.getValue() && this.lastSlayerType) {
- this.slayerXpElement.setText(`&6${this.lastSlayerType}&7> &f${numberWithCommas(this.slayerExp[this.lastSlayerType])} XP`);
+ this.slayerXpElement.setText(`&6${this.lastSlayerType}&7> &d&l${numberWithCommas(this.slayerExp[this.lastSlayerType])} XP`);
} else {
this.slayerXpElement.setText(``);
}