From d9922377660d9a722cced2859cdbc880d3fc5420 Mon Sep 17 00:00:00 2001 From: mfnalex <1122571+mfnalex@users.noreply.github.com> Date: Thu, 16 Jul 2020 04:38:38 +0200 Subject: [PATCH] Add support for 3rd party plugins firing PlayerInteractEvent (#146) * Add support for InvUnload * generalize 3rd party plugins' event check --- .../java/com/lishid/openinv/listeners/PlayerListener.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/src/main/java/com/lishid/openinv/listeners/PlayerListener.java b/plugin/src/main/java/com/lishid/openinv/listeners/PlayerListener.java index 7bbead2..5f6712a 100644 --- a/plugin/src/main/java/com/lishid/openinv/listeners/PlayerListener.java +++ b/plugin/src/main/java/com/lishid/openinv/listeners/PlayerListener.java @@ -54,6 +54,12 @@ public class PlayerListener implements Listener { @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerInteract(PlayerInteractEvent event) { + + // Do not cancel 3rd party plugins' custom events + if (!PlayerInteractEvent.class.equals(event.getClass())) { + return; + } + if (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getPlayer().isSneaking() || event.useInteractedBlock() == Result.DENY || event.getClickedBlock() == null || !plugin.getAnySilentContainer().isAnySilentContainer(event.getClickedBlock())) {