3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00

SPIGOT-1845: Use correct hand for interact events

Dieser Commit ist enthalten in:
BlackHole 2016-03-08 19:00:23 +01:00 committet von md_5
Ursprung 0705465a75
Commit 5d90f9712b

Datei anzeigen

@ -651,14 +651,14 @@
+ +
+ boolean cancelled = false; + boolean cancelled = false;
+ if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) { + if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, EnumHand.MAIN_HAND); + org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack, enumhand);
+ cancelled = event.useItemInHand() == Event.Result.DENY; + cancelled = event.useItemInHand() == Event.Result.DENY;
+ } else { + } else {
+ if (player.playerInteractManager.firedInteract) { + if (player.playerInteractManager.firedInteract) {
+ player.playerInteractManager.firedInteract = false; + player.playerInteractManager.firedInteract = false;
+ cancelled = player.playerInteractManager.interactResult; + cancelled = player.playerInteractManager.interactResult;
+ } else { + } else {
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectposition.a(), movingobjectposition.direction, itemstack, true, EnumHand.MAIN_HAND); + org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectposition.a(), movingobjectposition.direction, itemstack, true, enumhand);
+ cancelled = event.useItemInHand() == Event.Result.DENY; + cancelled = event.useItemInHand() == Event.Result.DENY;
+ } + }
} }