diff options
author | alemi <me@alemi.dev> | 2023-03-09 14:34:26 +0100 |
---|---|---|
committer | alemi <me@alemi.dev> | 2023-03-09 14:34:26 +0100 |
commit | c55013ffcd1aefa077e528ee9c4e785a11d3628a (patch) | |
tree | d42609e7ae8dea96a6baf9a2c4f464b3c9e8ebaf /src/main/java/ftbsc | |
parent | 0184889798abdc0e93fa5310958540e3d47fe37a (diff) |
fix: changed enable/disable task order
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/AbstractModule.java | 2 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java | 13 | ||||
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/self/Freecam.java | 4 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/AbstractModule.java b/src/main/java/ftbsc/bscv/modules/AbstractModule.java index 7227ea1..fc0542f 100644 --- a/src/main/java/ftbsc/bscv/modules/AbstractModule.java +++ b/src/main/java/ftbsc/bscv/modules/AbstractModule.java @@ -70,11 +70,11 @@ public abstract class AbstractModule implements IModule { } public void enable() { - IModule.super.enable(); if (!this.enabled.get()) { this.enabled.set(true); this.enabled.save(); } + IModule.super.enable(); log(String.format("%s ON", this.getName())); } diff --git a/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java b/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java index 214b141..c6ef507 100644 --- a/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java +++ b/src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java @@ -108,24 +108,23 @@ public class VanillaFlight extends QuickModule implements ICommons { @Override public void enable() { - super.enable(); this.tick = 0; if (MC.player != null) { this.couldFlyBefore = MC.player.abilities.mayfly; this.flyingSpeedBefore = MC.player.abilities.getFlyingSpeed(); } + super.enable(); } @Override public void disable() { - super.disable(); - ClientPlayerEntity player = MC.player; - if (player != null) { - player.abilities.mayfly = this.couldFlyBefore; - player.abilities.setFlyingSpeed(this.flyingSpeedBefore); + if (MC.player != null) { + MC.player.abilities.mayfly = this.couldFlyBefore; + MC.player.abilities.setFlyingSpeed(this.flyingSpeedBefore); if (this.force.get()) { - player.abilities.flying = false; + MC.player.abilities.flying = false; } } + super.disable(); } } diff --git a/src/main/java/ftbsc/bscv/modules/self/Freecam.java b/src/main/java/ftbsc/bscv/modules/self/Freecam.java index 33c27ae..92351ed 100644 --- a/src/main/java/ftbsc/bscv/modules/self/Freecam.java +++ b/src/main/java/ftbsc/bscv/modules/self/Freecam.java @@ -78,10 +78,9 @@ public class Freecam extends QuickModule implements ICommons { @Override public void enable() { - super.enable(); if (MC.player == null) { Boscovicino.log("[!] Can only enable freecam while in-game"); - this.disable(); + return; } this.prev_speed = MC.player.abilities.getFlyingSpeed(); @@ -100,6 +99,7 @@ public class Freecam extends QuickModule implements ICommons { this.mock_player.setPosAndOldPos(this.prev_pos.x, this.prev_pos.y, this.prev_pos.z); this.mock_player.setYBodyRot(MC.player.yBodyRot); MC.level.addPlayer(-666, this.mock_player); + super.enable(); } @Override |