3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 04:50:05 +01:00

Add hitEntity to ProjectileHitEvent

Dieser Commit ist enthalten in:
md_5 2016-11-28 12:47:01 +11:00
Ursprung 2ba48b4965
Commit 1c07d5c78f
5 geänderte Dateien mit 6 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -27,7 +27,7 @@
protected void a(MovingObjectPosition movingobjectposition) {
Entity entity = movingobjectposition.entity;
-
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event
if (entity != null) {
float f = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
int i = MathHelper.f((double) f * this.damage);

Datei anzeigen

@ -44,7 +44,7 @@
+
+ // CraftBukkit start - Fire ProjectileHitEvent
+ if (this.dead) {
+ CraftEventFactory.callProjectileHitEvent(this);
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+ }
+ // CraftBukkit end
}

Datei anzeigen

@ -16,7 +16,7 @@
}
if (movingobjectposition != null && movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.MISS) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // Craftbukkit - Call event
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
this.hooked = movingobjectposition.entity;
this.s();

Datei anzeigen

@ -14,7 +14,7 @@
this.a(movingobjectposition);
+ // CraftBukkit start
+ if (this.dead) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+ }
+ // CraftBukkit end
}

Datei anzeigen

@ -778,8 +778,8 @@ public class CraftEventFactory {
return event;
}
public static ProjectileHitEvent callProjectileHitEvent(Entity entity) {
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity());
public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) {
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entity == null ? null : position.entity.getBukkitEntity());
entity.world.getServer().getPluginManager().callEvent(event);
return event;
}