Skip to content

Commit

Permalink
don't check item usage in MultiActionsC/D
Browse files Browse the repository at this point in the history
  • Loading branch information
ManInMyVan committed Jan 19, 2025
1 parent 111cc7a commit 75bcac7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;

@CheckData(name = "MultiActionsC", description = "Clicked in inventory while performing other actions", experimental = true)
@CheckData(name = "MultiActionsC", description = "Clicked in inventory while sprinting", experimental = true)
public class MultiActionsC extends Check implements PacketCheck {
public MultiActionsC(GrimPlayer player) {
super(player);
Expand All @@ -19,13 +19,8 @@ public MultiActionsC(GrimPlayer player) {
@Override
public void onPacketReceive(PacketReceiveEvent event) {
if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW) {
String verbose = player.isSprinting && !player.isSwimming && !serverOpenedInventoryThisTick ? "sprinting" : "";

if (player.packetStateData.isSlowedByUsingItem()) {
verbose += (verbose.isEmpty() ? "" : ", ") + "using";
}

if (!verbose.isEmpty() && flagAndAlert(verbose) && shouldModifyPackets()) {
if (player.isSprinting && !player.isSwimming && !serverOpenedInventoryThisTick && flagAndAlert() && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;

@CheckData(name = "MultiActionsD", description = "Closed inventory while performing other actions", experimental = true)
@CheckData(name = "MultiActionsD", description = "Closed inventory while sprinting", experimental = true)
public class MultiActionsD extends Check implements PacketCheck {
public MultiActionsD(GrimPlayer player) {
super(player);
Expand All @@ -16,13 +16,7 @@ public MultiActionsD(GrimPlayer player) {
@Override
public void onPacketReceive(PacketReceiveEvent event) {
if (event.getPacketType() == PacketType.Play.Client.CLOSE_WINDOW) {
String verbose = player.isSprinting && !player.isSwimming ? "sprinting" : "";

if (player.packetStateData.isSlowedByUsingItem()) {
verbose += (verbose.isEmpty() ? "" : ", ") + "using";
}

if (!verbose.isEmpty() && flagAndAlert(verbose) && shouldModifyPackets()) {
if (player.isSprinting && !player.isSwimming && flagAndAlert() && shouldModifyPackets()) {
event.setCancelled(true);
player.onPacketCancel();
}
Expand Down

0 comments on commit 75bcac7

Please sign in to comment.