Fixes a bug in inventory clicking

Fixes a bug where players clicking items in their own inventory while a custom inventory is open triggers items in the custom inventory.
This commit is contained in:
Kristian Knarvik 2023-05-11 17:22:59 +02:00
parent 1aa33e87c5
commit d839955808

View File

@ -6,6 +6,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerQuitEvent;
/**
@ -36,7 +37,8 @@ public class GUIListener implements Listener {
AbstractGUI gui = GUIRegistry.getOpenGUI(player);
//Not our GUI
if (gui == null) {
if (gui == null || event.getClickedInventory() == null ||
event.getClickedInventory().getType() == InventoryType.PLAYER) {
return;
}