Skip to content

Commit

Permalink
Update RotationFailsafe.java
Browse files Browse the repository at this point in the history
  • Loading branch information
onixiya1337 committed Mar 14, 2024
1 parent 372b7f6 commit fcc09bd
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,14 @@ public void duringFailsafeTrigger() {

switch (rotationCheckState) {
case NONE:
if (checkIfRotatedBack())
return;
rotationCheckState = RotationCheckState.WAIT_BEFORE_START;
FailsafeManager.getInstance().scheduleRandomDelay(500, 500);
break;
case WAIT_BEFORE_START:
if (checkIfRotatedBack())
return;
MacroHandler.getInstance().pauseMacro();
if (rotationBeforeReacting == null)
rotationBeforeReacting = new Rotation(mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch);
Expand Down Expand Up @@ -228,6 +232,19 @@ public void resetStates() {
rotation.reset();
}

private boolean checkIfRotatedBack() {
if (rotationBeforeReacting.getYaw() == AngleUtils.get360RotationYaw()
&& rotationBeforeReacting.getPitch() == mc.thePlayer.rotationPitch
&& Math.abs(AngleUtils.get360RotationYaw(rotationBeforeReacting.getYaw()) - AngleUtils.get360RotationYaw()) < 0.1) {
FailsafeManager.getInstance().stopFailsafes();
LogUtils.sendWarning("[Failsafe] Rotation check failsafe was triggered but the admin rotated you back. DO NOT REACT TO THIS OR YOU WILL GET BANNED!");
if (FailsafeNotificationsPage.notifyOnRotationFailsafe)
LogUtils.webhookLog("[Failsafe]\nRotation check failsafe was triggered but the admin rotated you back. DO NOT REACT TO THIS OR YOU WILL GET BANNED!");
return true;
}
return false;
}

private RotationCheckState rotationCheckState = RotationCheckState.NONE;
private final RotationHandler rotation = RotationHandler.getInstance();
private BlockPos positionBeforeReacting = null;
Expand Down

0 comments on commit fcc09bd

Please sign in to comment.