From c55013ffcd1aefa077e528ee9c4e785a11d3628a Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 9 Mar 2023 14:34:26 +0100 Subject: fix: changed enable/disable task order --- src/main/java/ftbsc/bscv/modules/AbstractModule.java | 2 +- src/main/java/ftbsc/bscv/modules/motion/VanillaFlight.java | 13 ++++++------- src/main/java/ftbsc/bscv/modules/self/Freecam.java | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src/main') 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 -- cgit v1.2.3-56-ga3b1