File tree Expand file tree Collapse file tree 1 file changed +1
-8
lines changed
common/src/main/java/xyz/jonesdev/sonar/common/fallback/verification Expand file tree Collapse file tree 1 file changed +1
-8
lines changed Original file line number Diff line number Diff line change @@ -86,8 +86,6 @@ public void handle(final @NotNull FallbackPacket packet) {
8686 final int slotId = heldItemPacket .getSlot ();
8787 // Also check if the player sent an invalid slot which is impossible by vanilla protocol
8888 checkState (slotId >= 0 && slotId <= 8 , "slot out of range: " + slotId );
89- // Check if the player sent a duplicate slot packet which is impossible by vanilla protocol
90- checkState (slotId != currentClientSlotId , "duplicate slot: " + slotId );
9189
9290 // Only continue checking if we're actually expecting a SetHeldItem packet
9391 if (expectedSlotId != -1
@@ -148,12 +146,7 @@ private void sendSetHeldItem() {
148146 user .delayedWrite (INVALID_HELD_ITEM_SLOT );
149147 // Increment the player's slot by a random slot, and then modulo it by the maximum slot (8)
150148 expectedSlotId = (currentClientSlotId + 1 + RANDOM .nextInt (7 )) % 8 ;
151- // Send two SetHeldItem packets with the same slot to check if the player responds with the correct slot.
152- // By vanilla protocol, the client does not respond to duplicate SetHeldItem packets.
153- // We can take advantage of this by sending two packets with the same content to check for a valid response.
154- final SetHeldItemPacket heldItemPacket = new SetHeldItemPacket (expectedSlotId );
155- user .delayedWrite (heldItemPacket );
156- user .delayedWrite (heldItemPacket );
149+ user .delayedWrite (new SetHeldItemPacket (expectedSlotId ));
157150 user .channel ().flush ();
158151 }
159152
You can’t perform that action at this time.
0 commit comments