EnderContainers

EnderContainers

2.5k Downloads

Can open enderchest even if PlayerInteractEvent is canceled, any way to solve?

afoxxvi opened this issue ยท 2 comments

commented

I have a plugin that may cancel PlayerInteract Event, however enderchest was still opened.
I don't want player can open enderchest even if I canceled the interact event because I have something else to do.

commented

OK, thanks a lot!

commented

Hello! As you can see in the code below, I do not check if the event has already been cancelled.
I forgot to handle this case, I'll change that. Thanks for the feedback!

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (!event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) return;
Player player = event.getPlayer();
Block block = event.getClickedBlock();