Fixed ArrayIndexOutOfBoundsException when dragging items outside of GUIs

This commit is contained in:
NichtStudioCode 2021-10-06 16:51:50 +02:00
parent a09ad3d065
commit 0ecea11053

@ -124,7 +124,11 @@ public abstract class BaseWindow implements Window {
} }
// Redraw all items after the event so there won't be any Items that aren't actually there // Redraw all items after the event so there won't be any Items that aren't actually there
Bukkit.getScheduler().runTask(InvUI.getInstance().getPlugin(), () -> event.getRawSlots().forEach(this::redrawItem)); Bukkit.getScheduler().runTask(InvUI.getInstance().getPlugin(),
() -> event.getRawSlots().forEach(rawSlot -> {
if (getGuiAt(rawSlot) != null) redrawItem(rawSlot);
})
);
// update the amount on the cursor // update the amount on the cursor
ItemStack cursorStack = event.getOldCursor(); ItemStack cursorStack = event.getOldCursor();