Skip to content

Commit

Permalink
Fixed edge case in update op level handling
Browse files Browse the repository at this point in the history
Fixes #76
  • Loading branch information
RaphiMC committed Jul 26, 2024
1 parent a798479 commit c87ec97
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,12 @@ public void updateHax(final boolean flying, final boolean noClip, final boolean
}

public void setOpLevel(final byte opLevel) {
final boolean changed = this.opLevel != opLevel;
this.opLevel = opLevel;

if (this.haxEnabled) {
final ClassicServerTitleStorage serverTitleStorage = this.getUser().get(ClassicServerTitleStorage.class);
this.updateHax(serverTitleStorage.isFlyEffectivelyEnabled(), serverTitleStorage.isNoclipEffectivelyEnabled(), serverTitleStorage.isSpeedEffectivelyEnabled(), serverTitleStorage.isRespawnEffectivelyEnabled());
if (changed) {
this.updateAbilities();
if (serverTitleStorage != null) { // Some servers update the op level before sending the login packet. Just ignore that because the op level is resent in the login packet.
this.updateHax(serverTitleStorage.isFlyEffectivelyEnabled(), serverTitleStorage.isNoclipEffectivelyEnabled(), serverTitleStorage.isSpeedEffectivelyEnabled(), serverTitleStorage.isRespawnEffectivelyEnabled());
}
}
}
Expand Down

0 comments on commit c87ec97

Please sign in to comment.