mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
Add support for 3rd party plugins firing PlayerInteractEvent (#146)
* Add support for InvUnload * generalize 3rd party plugins' event check
This commit is contained in:
parent
c93464e643
commit
d992237766
1 changed files with 6 additions and 0 deletions
|
@ -54,6 +54,12 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
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()
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getPlayer().isSneaking()
|
||||||
|| event.useInteractedBlock() == Result.DENY || event.getClickedBlock() == null
|
|| event.useInteractedBlock() == Result.DENY || event.getClickedBlock() == null
|
||||||
|| !plugin.getAnySilentContainer().isAnySilentContainer(event.getClickedBlock())) {
|
|| !plugin.getAnySilentContainer().isAnySilentContainer(event.getClickedBlock())) {
|
||||||
|
|
Loading…
Reference in a new issue