CustomCrafting icon indicating copy to clipboard operation
CustomCrafting copied to clipboard

CustomCrafting ignores `InventoryClickEvent` cancellation

Open imDaniX opened this issue 3 years ago • 0 comments

What happened?

If InventoryClickEvent is being cancelled, CustomCrafting ignores it and proceeds to craft an item anyway. That's a potential dupe with third-party plugins (and already is with a popular one), and generally is an unexpected behavior for some plugins.

Might be an easy fix just by adding ignoreCancelled = true to listener(s?), but I don't know much about plugin's internals, so would rather leave it to you.

How can the bug be reproduced?

@EventHandler(priority = EventPriority.LOWEST)
public void onInvClick(InventoryClickEvent event) {
    if (event.getClickedInventory().getType() == InventoryType.WORKBENCH) {
        event.setCancelled(true);
    }
}

(was lazy to add a check for clicked slot, but adding items into workbench is possible via recipe book)

Expected Behaviour?

Nothing should happen.

Plugin version

CustomCrafting 4.16.3.2, WolfyUtilities 4.16.9.6

Server software

Pufferfish-56 (MC: 1.19.3)

Relevant log output

No response

Submit issue

  • [X] read the Wiki and especially the FaQ, and made sure there is no fix to your issue,
  • [X] searched for and ensured there isn't already an open issue regarding this,
  • [X] are running the latest version of your server software (Spigot, Paper, etc.), and plugins (WolfyUtilities, CustomCrafting).

imDaniX avatar Jan 26 '23 14:01 imDaniX