fix: changed enable/disable task order

This commit is contained in:
əlemi 2023-03-09 14:34:26 +01:00
parent 0184889798
commit c55013ffcd
Signed by: alemi
GPG key ID: A4895B84D311642C
3 changed files with 9 additions and 10 deletions

View file

@ -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()));
}

View file

@ -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();
}
}

View file

@ -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