diff --git a/src/main/java/com/songoda/core/gui/Gui.java b/src/main/java/com/songoda/core/gui/Gui.java index 593ed00c..0a3f0004 100644 --- a/src/main/java/com/songoda/core/gui/Gui.java +++ b/src/main/java/com/songoda/core/gui/Gui.java @@ -52,6 +52,7 @@ public class Gui { protected static ItemStack AIR = new ItemStack(Material.AIR); protected boolean open = false; + protected Clickable defaultClicker = null; protected Openable opener = null; protected Closable closer = null; protected Droppable dropper = null; @@ -211,6 +212,11 @@ public class Gui { return this; } + public Gui setDefaultAction(Clickable action) { + defaultClicker = action; + return this; + } + public Gui setDefaultItem(ItemStack item) { blankItem = item; return this; @@ -602,6 +608,10 @@ public class Gui { button.onClick(new GuiClickEvent(manager, this, player, event, cell, true)); } else { // no event for this button + if(defaultClicker != null) { + // this is a default action, not a triggered action + defaultClicker.onClick(new GuiClickEvent(manager, this, player, event, cell, true)); + } return false; } return true;