Skip to content

Commit

Permalink
fix crash & reduce exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
AoElite committed Nov 9, 2023
1 parent 7355a23 commit 919bd4f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/main/java/ac/grim/grimac/checks/impl/crash/CrashF.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ public void onPacketReceive(final PacketReceiveEvent event) {
int clickType = click.getWindowClickType().ordinal();
int button = click.getButton();
int windowId = click.getWindowId();
int slot = click.getSlot();

if ((clickType == 1 || clickType == 2) && windowId >= 0 && button < 0) {
if (flagAndAlert("clickType=" + clickType + " button=" + button)) {
event.setCancelled(true);
player.onPacketCancel();
}
}

else if (windowId >= 0 && clickType == 2 && slot < 0) {
if (flagAndAlert("clickType=" + clickType + " button=" + button + " slot=" + slot)) {
event.setCancelled(true);
player.onPacketCancel();
}
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public void onPacketReceive(final PacketReceiveEvent event) {
}
}

if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW) {
if (event.getPacketType() == PacketType.Play.Client.CLICK_WINDOW && !event.isCancelled()) {
WrapperPlayClientClickWindow click = new WrapperPlayClientClickWindow(event);

// How is this possible? Maybe transaction splitting.
Expand Down

0 comments on commit 919bd4f

Please sign in to comment.