Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
PyvesB committed Jun 6, 2019
2 parents 11d2c24 + c4eb6fa commit 2e85793
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public void onInventoryClick(InventoryClickEvent event) {
// Prevent players from taking items out of the GUI.
event.setCancelled(true);

// Clicking empty slots should do nothing
if (event.getCurrentItem() == null) {
return;
}

int currentPage = ((AchievementInventoryHolder) inventory.getHolder()).getPageIndex();
Player player = (Player) event.getWhoClicked();
if (currentPage == MAIN_GUI_PAGE) {
Expand Down Expand Up @@ -90,7 +95,7 @@ public void onInventoryClick(InventoryClickEvent event) {
* @return true if the button is clicked, false otherwise
*/
private boolean isButtonClicked(InventoryClickEvent event, ItemStack button) {
if (event.getCurrentItem() != null && event.getCurrentItem().isSimilar(button)) {
if (event.getCurrentItem().isSimilar(button)) {
// Clicked item seems to be the button. But player could have clicked on item in his personal inventory that
// matches the properties of the button used by Advanced Achievements. The first item matching the
// properties of the button is the real one, check that this is indeed the clicked one.
Expand Down

0 comments on commit 2e85793

Please sign in to comment.