mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 15:49:00 +01:00
Fix ProjectilCollideEvent cancellation (Fixes #2953)
This commit is contained in:
parent
8c4bc5f8b1
commit
96b258cfbb
2 changed files with 23 additions and 26 deletions
|
@ -5,7 +5,7 @@ Subject: [PATCH] Add ProjectileCollideEvent
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
index 2b14b2c3f..634e2bd30 100644
|
||||
index 2b14b2c3fa..634e2bd304 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityArrow extends Entity implements IProjectile {
|
||||
|
@ -27,7 +27,7 @@ index 2b14b2c3f..634e2bd30 100644
|
|||
this.a((MovingObjectPosition) object);
|
||||
this.impulse = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
|
||||
index 078cc2523..6756c79b3 100644
|
||||
index 078cc25231..6756c79b31 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFireball.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityFireball extends Entity {
|
||||
|
@ -49,7 +49,7 @@ index 078cc2523..6756c79b3 100644
|
|||
|
||||
// CraftBukkit start - Fire ProjectileHitEvent
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
index 39e3bd379..0a17715a1 100644
|
||||
index 39e3bd3795..807ec3394d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
|
||||
|
@ -57,8 +57,6 @@ index 39e3bd379..0a17715a1 100644
|
|||
}, RayTrace.BlockCollisionOption.COLLIDER, true);
|
||||
|
||||
- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event
|
||||
+ // Paper start - Call ProjectileCollideEvent
|
||||
+ if (movingobjectposition instanceof MovingObjectPositionEntity) {
|
||||
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition);
|
||||
|
@ -68,13 +66,12 @@ index 39e3bd379..0a17715a1 100644
|
|||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // Craftbukkit - Call event
|
||||
+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled
|
||||
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event
|
||||
if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
|
||||
this.hooked = ((MovingObjectPositionEntity) movingobjectposition).getEntity();
|
||||
this.n();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
index 2e4c9d426..724b78b5d 100644
|
||||
index 2e4c9d4267..724b78b5d2 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
||||
|
@ -96,7 +93,7 @@ index 2e4c9d426..724b78b5d 100644
|
|||
this.c(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition());
|
||||
} else {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 95973558e..c45b7c15f 100644
|
||||
index 95973558e3..c45b7c15fc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
|
|
|
@ -8,7 +8,7 @@ Adds lots of information about why this orb exists.
|
|||
Replaces isFromBottle() with logic that persists entity reloads too.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
|
||||
index 5de881371..5f261b9b9 100644
|
||||
index 5de881371a..5f261b9b92 100644
|
||||
--- a/src/main/java/net/minecraft/server/Block.java
|
||||
+++ b/src/main/java/net/minecraft/server/Block.java
|
||||
@@ -0,0 +0,0 @@ public class Block implements IMaterial {
|
||||
|
@ -28,7 +28,7 @@ index 5de881371..5f261b9b9 100644
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
||||
index 2d2cd09ad..ed88e208d 100644
|
||||
index 2d2cd09ad1..ed88e208d0 100644
|
||||
--- a/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
||||
+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java
|
||||
@@ -0,0 +0,0 @@ public class ContainerGrindstone extends Container {
|
||||
|
@ -41,7 +41,7 @@ index 2d2cd09ad..ed88e208d 100644
|
|||
|
||||
world.triggerEffect(1042, blockposition, 0);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
index 876257769..138e2ea56 100644
|
||||
index 8762577696..138e2ea56a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
|
@ -54,7 +54,7 @@ index 876257769..138e2ea56 100644
|
|||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
index 0447800d9..d4275e733 100644
|
||||
index 0447800d9d..d4275e733d 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
|
||||
@@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity {
|
||||
|
@ -134,7 +134,7 @@ index 0447800d9..d4275e733 100644
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
index 0a17715a1..cbd30b33b 100644
|
||||
index 807ec3394d..73f5961aa3 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity {
|
||||
|
@ -147,7 +147,7 @@ index 0a17715a1..cbd30b33b 100644
|
|||
// CraftBukkit end
|
||||
if (itemstack1.getItem().a(TagsItem.FISHES)) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index dd1caec9d..2775afc32 100644
|
||||
index dd1caec9da..2775afc327 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -161,7 +161,7 @@ index dd1caec9d..2775afc32 100644
|
|||
this.expToDrop = 0;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
||||
index 0bfc0a773..ba2f90cc6 100644
|
||||
index 0bfc0a773d..ba2f90cc6a 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
|
||||
@@ -0,0 +0,0 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable {
|
||||
|
@ -174,7 +174,7 @@ index 0bfc0a773..ba2f90cc6 100644
|
|||
|
||||
this.die();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java
|
||||
index c73cc9ae4..76296119a 100644
|
||||
index c73cc9ae4b..76296119a1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityTurtle.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityTurtle.java
|
||||
@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal {
|
||||
|
@ -187,7 +187,7 @@ index c73cc9ae4..76296119a 100644
|
|||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index 5e3835851..6ca4fa43c 100644
|
||||
index 5e3835851d..6ca4fa43c4 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
|
@ -200,7 +200,7 @@ index 5e3835851..6ca4fa43c 100644
|
|||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
||||
index 530c69996..2ad8dba5c 100644
|
||||
index 530c699964..2ad8dba5c0 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java
|
||||
@@ -0,0 +0,0 @@ public class EntityVillagerTrader extends EntityVillagerAbstract {
|
||||
|
@ -213,7 +213,7 @@ index 530c69996..2ad8dba5c 100644
|
|||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
|
||||
index 1ab2668e9..2b708761d 100644
|
||||
index 1ab2668e91..2b708761d0 100644
|
||||
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
|
||||
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
|
||||
@@ -0,0 +0,0 @@ public class PathfinderGoalBreed extends PathfinderGoal {
|
||||
|
@ -226,7 +226,7 @@ index 1ab2668e9..2b708761d 100644
|
|||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
index f6c6ea4aa..dff3eb118 100644
|
||||
index f6c6ea4aaf..dff3eb1188 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerInteractManager {
|
||||
|
@ -239,7 +239,7 @@ index f6c6ea4aa..dff3eb118 100644
|
|||
|
||||
return true;
|
||||
diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
||||
index d2698e847..edc4a5c34 100644
|
||||
index d2698e847c..edc4a5c34e 100644
|
||||
--- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
||||
+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
|
@ -252,7 +252,7 @@ index d2698e847..edc4a5c34 100644
|
|||
|
||||
public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) {
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
index 8dc47452a..560e2f42b 100644
|
||||
index 8dc47452a4..560e2f42b7 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
|
||||
@@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I
|
||||
|
@ -265,7 +265,7 @@ index 8dc47452a..560e2f42b 100644
|
|||
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index a41b32ddc..462458645 100644
|
||||
index a41b32ddc7..462458645e 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -0,0 +0,0 @@ public class CraftWorld implements World {
|
||||
|
@ -278,7 +278,7 @@ index a41b32ddc..462458645 100644
|
|||
entity = new EntityLightning(world, x, y, z, false);
|
||||
} else if (Firework.class.isAssignableFrom(clazz)) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
index 1b512cc45..fbad04567 100644
|
||||
index 1b512cc45c..fbad045675 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
||||
@@ -0,0 +0,0 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
|
||||
|
|
Loading…
Reference in a new issue