Created
January 5, 2013 04:54
-
-
Save mkremins/4459835 to your computer and use it in GitHub Desktop.
Bukkit: detect whether an inventory click falls within the top or bottom inventory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EventHandler | |
public void onInvClick(InventoryClickEvent event) { | |
Player p = (Player) event.getWhoClicked(); | |
if(event.getRawSlot() == event.getSlot()) { | |
p.sendMessage("TOP"); | |
} | |
else { | |
p.sendMessage("BOTTOM"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
doesn't seem to work on 9 slot inventories, use this instead to detect clicks in the top inventory.
event.getRawSlot() < event.getView().getTopInventory().getSize()