SPIGOT-5794: Only skip interact event if position, hand and itemstack are equal

By: Brokkonaut <hannos17@gmx.de>
This commit is contained in:
CraftBukkit/Spigot
2020-09-12 08:36:10 +10:00
parent 5425f6ba43
commit c6d968eda2
2 changed files with 13 additions and 7 deletions

View File

@@ -717,14 +717,14 @@
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand);
+ cancelled = event.useItemInHand() == Event.Result.DENY;
+ } else {
+ if (player.playerInteractManager.firedInteract) {
+ player.playerInteractManager.firedInteract = false;
+ MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
+ if (player.playerInteractManager.firedInteract && player.playerInteractManager.interactPosition.equals(movingobjectpositionblock.getBlockPosition()) && player.playerInteractManager.interactHand == enumhand && ItemStack.equals(player.playerInteractManager.interactItemStack, itemstack)) {
+ cancelled = player.playerInteractManager.interactResult;
+ } else {
+ MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPosition(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand);
+ cancelled = event.useItemInHand() == Event.Result.DENY;
+ }
+ player.playerInteractManager.firedInteract = false;
+ }
+
+ if (cancelled) {