Skip to content

Commit bf3242b

Browse files
committed
backport 86dbd06
1 parent 4067465 commit bf3242b

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

fabric-1.20.1/src/main/java/io/tebex/plugin/gui/TebexBuyScreenHandler.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ public void onSlotClick(int slotId, int button, SlotActionType actionType, Playe
2525
return;
2626
}
2727

28-
if (slotId >= 0 && slotId < this.slots.size()) {
29-
ItemStack clickedStack = this.getSlot(slotId).getStack();
28+
if (actionType != SlotActionType.PICKUP) { // Ignore non-pickup only actions
29+
return;
30+
}
31+
32+
if (slotId > this.getInventory().size()) { // Ignore slot clicks outsize of the buy inventory
33+
return;
34+
}
35+
36+
if (slotId >= 0 && slotId < this.getInventory().size()) {
3037
TebexGuiItem item = guiItems.get(slotId);
3138
if (item != null && item.getAction() != null) {
3239
item.getAction().execute(this);

fabric-1.20.4/src/main/java/io/tebex/plugin/gui/TebexBuyScreenHandler.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ public void onSlotClick(int slotId, int button, SlotActionType actionType, Playe
2525
return;
2626
}
2727

28-
if (slotId >= 0 && slotId < this.slots.size()) {
29-
ItemStack clickedStack = this.getSlot(slotId).getStack();
28+
if (actionType != SlotActionType.PICKUP) { // Ignore non-pickup only actions
29+
return;
30+
}
31+
32+
if (slotId > this.getInventory().size()) { // Ignore slot clicks outsize of the buy inventory
33+
return;
34+
}
35+
36+
if (slotId >= 0 && slotId < this.getInventory().size()) {
3037
TebexGuiItem item = guiItems.get(slotId);
3138
if (item != null && item.getAction() != null) {
3239
item.getAction().execute(this);

0 commit comments

Comments
 (0)