Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
38b3182a90
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: befcf86d SPIGOT-7740: Fix using new map cursor types 09229095 Add EntityDamageEvent.DamageCause#CAMPFIRE CraftBukkit Changes: a1d2cd152 SPIGOT-7747: Mob head is not dropped when mob was blown up by a charged creeper 8078294bc SPIGOT-7746: Server Crashing when Players Getting into End Portals 8d842e250 SPIGOT-7744: Fix exception for shooting projectiles with flame enchantment 64e0ad129 SPIGOT-7744: Fix crash when shooting arrows in creative mode 819f7a10a Fix player items not dropping on death 0a0229bb5 Implement DamageCause#CAMPFIRE and minor improvement in exception for Unhandled block damage
46 Zeilen
2.4 KiB
Diff
46 Zeilen
2.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Techcable <Techcable@outlook.com>
|
|
Date: Fri, 16 Dec 2016 21:25:39 -0600
|
|
Subject: [PATCH] Add ProjectileCollideEvent
|
|
|
|
Deprecated now and replaced with ProjectileHitEvent
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
index ad799d1d0f46663d5bc850763629f430d00b58fe..a4060019e30f6fc64e10494ed41d6613d1b894d7 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
|
@@ -1295,6 +1295,17 @@ public class CraftEventFactory {
|
|
return CraftItemStack.asNMSCopy(bitem);
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Deprecated
|
|
+ public static com.destroystokyo.paper.event.entity.ProjectileCollideEvent callProjectileCollideEvent(Entity entity, EntityHitResult position) {
|
|
+ Projectile projectile = (Projectile) entity.getBukkitEntity();
|
|
+ org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity();
|
|
+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided);
|
|
+ Bukkit.getPluginManager().callEvent(event);
|
|
+ return event;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) {
|
|
Projectile bukkitEntity = (Projectile) entity.getBukkitEntity();
|
|
ProjectileLaunchEvent event = new ProjectileLaunchEvent(bukkitEntity);
|
|
@@ -1319,8 +1330,15 @@ public class CraftEventFactory {
|
|
if (position.getType() == HitResult.Type.ENTITY) {
|
|
hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity();
|
|
}
|
|
+ // Paper start - legacy event
|
|
+ boolean cancelled = false;
|
|
+ if (hitEntity != null && position instanceof EntityHitResult entityHitResult) {
|
|
+ cancelled = callProjectileCollideEvent(entity, entityHitResult).isCancelled();
|
|
+ }
|
|
+ // Paper end
|
|
|
|
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), hitEntity, hitBlock, hitFace);
|
|
+ event.setCancelled(cancelled); // Paper - propagate legacy event cancellation to modern event
|
|
entity.level().getCraftServer().getPluginManager().callEvent(event);
|
|
return event;
|
|
}
|