From 2858cb9659b83a285ef7c019c87f2f76b03ad13e Mon Sep 17 00:00:00 2001 From: Ayouuuu Date: Tue, 16 Apr 2024 12:56:03 +0800 Subject: [PATCH] style: rename BadPacketsW to BadPacketsV --- .../badpackets/{BadPacketsW.java => BadPacketsV.java} | 8 +++----- src/main/java/ac/grim/grimac/manager/CheckManager.java | 2 +- .../grim/grimac/utils/latency/CompensatedInventory.java | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) rename src/main/java/ac/grim/grimac/checks/impl/badpackets/{BadPacketsW.java => BadPacketsV.java} (80%) diff --git a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsW.java b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsV.java similarity index 80% rename from src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsW.java rename to src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsV.java index 0e9cdb1690..ad9f55b320 100644 --- a/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsW.java +++ b/src/main/java/ac/grim/grimac/checks/impl/badpackets/BadPacketsV.java @@ -7,18 +7,16 @@ import com.github.retrooper.packetevents.event.PacketReceiveEvent; import com.github.retrooper.packetevents.protocol.item.ItemStack; import com.github.retrooper.packetevents.protocol.packettype.PacketType; -import com.github.retrooper.packetevents.protocol.player.ClientVersion; import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity; -@CheckData(name = "BadPacketsW", experimental = true) -public class BadPacketsW extends Check implements PacketCheck { - public BadPacketsW(GrimPlayer player) { +@CheckData(name = "BadPacketsV", experimental = true) +public class BadPacketsV extends Check implements PacketCheck { + public BadPacketsV(GrimPlayer player) { super(player); } @Override public void onPacketReceive(PacketReceiveEvent event) { - if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9)) return; if (event.getPacketType() == PacketType.Play.Client.INTERACT_ENTITY) { WrapperPlayClientInteractEntity interactEntity = new WrapperPlayClientInteractEntity(event); if (interactEntity.getAction() != WrapperPlayClientInteractEntity.InteractAction.ATTACK) return; diff --git a/src/main/java/ac/grim/grimac/manager/CheckManager.java b/src/main/java/ac/grim/grimac/manager/CheckManager.java index fa5b8ce001..d3981f7d3d 100644 --- a/src/main/java/ac/grim/grimac/manager/CheckManager.java +++ b/src/main/java/ac/grim/grimac/manager/CheckManager.java @@ -88,7 +88,7 @@ public CheckManager(GrimPlayer player) { .put(BadPacketsS.class, new BadPacketsS(player)) .put(BadPacketsT.class, new BadPacketsT(player)) .put(BadPacketsU.class, new BadPacketsU(player)) - .put(BadPacketsW.class, new BadPacketsW(player)) + .put(BadPacketsV.class, new BadPacketsV(player)) .put(FastBreak.class, new FastBreak(player)) .put(TransactionOrder.class, new TransactionOrder(player)) .put(NoSlowB.class, new NoSlowB(player)) diff --git a/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java b/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java index e329926950..aad4841c2b 100644 --- a/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java +++ b/src/main/java/ac/grim/grimac/utils/latency/CompensatedInventory.java @@ -108,7 +108,7 @@ private void markPlayerSlotAsChanged(int clicked) { } public ItemStack getItemInHand(InteractionHand hand) { - return hand == InteractionHand.MAIN_HAND ? getByEquipmentType(EquipmentType.MAINHAND) : getByEquipmentType(EquipmentType.OFFHAND); + return hand == InteractionHand.MAIN_HAND ? getHeldItem() : getOffHand(); } private void markServerForChangingSlot(int clicked, int windowID) {