mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-07 07:32:03 -07:00
SPIGOT-6122: Revert "SPIGOT-5794: Do not skip PlayerInteractEvent"
This reverts commit 00bff02703
.
This commit is contained in:
@@ -162,10 +162,10 @@
|
||||
+ if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.hasBlock(nmsBlock.getBlockData())) {
|
||||
+ event.setExpToDrop(nmsBlock.getExpDrop(nmsData, this.world, blockposition, itemstack));
|
||||
+ }
|
||||
+
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
- if (!this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.world, blockposition, (EntityHuman) this.player)) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ if (isSwordNoBreak) {
|
||||
+ return false;
|
||||
@@ -243,11 +243,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,12 +423,37 @@
|
||||
@@ -287,12 +423,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - whole method
|
||||
+ public boolean interactResult = false;
|
||||
+ public boolean firedInteract = false;
|
||||
public EnumInteractionResult a(EntityPlayer entityplayer, World world, ItemStack itemstack, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition();
|
||||
IBlockData iblockdata = world.getType(blockposition);
|
||||
@@ -264,7 +266,8 @@
|
||||
+ }
|
||||
+
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityplayer, Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectpositionblock.getDirection(), itemstack, cancelledBlock, enumhand);
|
||||
+ boolean interactResult = event.useItemInHand() == Event.Result.DENY;
|
||||
+ firedInteract = true;
|
||||
+ interactResult = event.useItemInHand() == Event.Result.DENY;
|
||||
+
|
||||
+ if (event.useInteractedBlock() == Event.Result.DENY) {
|
||||
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||
@@ -281,7 +284,7 @@
|
||||
|
||||
if (itileinventory != null) {
|
||||
entityplayer.openContainer(itileinventory);
|
||||
@@ -306,7 +467,7 @@
|
||||
@@ -306,7 +470,7 @@
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
|
||||
if (!flag1) {
|
||||
@@ -290,7 +293,7 @@
|
||||
|
||||
if (enuminteractionresult.a()) {
|
||||
CriterionTriggers.M.a(entityplayer, blockposition, itemstack1);
|
||||
@@ -314,17 +475,17 @@
|
||||
@@ -314,17 +478,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +314,7 @@
|
||||
}
|
||||
|
||||
if (enuminteractionresult1.a()) {
|
||||
@@ -332,10 +493,10 @@
|
||||
@@ -332,10 +496,10 @@
|
||||
}
|
||||
|
||||
return enuminteractionresult1;
|
||||
|
Reference in New Issue
Block a user