From c87ec975bda65abf46f46d1ad88c10ec8c273f57 Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Fri, 26 Jul 2024 18:41:48 +0200 Subject: [PATCH] Fixed edge case in update op level handling Fixes #76 --- .../c0_28_30toa1_0_15/storage/ClassicOpLevelStorage.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/storage/ClassicOpLevelStorage.java b/src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/storage/ClassicOpLevelStorage.java index c388737..c39a096 100644 --- a/src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/storage/ClassicOpLevelStorage.java +++ b/src/main/java/net/raphimc/vialegacy/protocol/classic/c0_28_30toa1_0_15/storage/ClassicOpLevelStorage.java @@ -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()); } } }