geforkt von Mirrors/Paper
Update upstream B/CB - hitEntity added upstream
Dieser Commit ist enthalten in:
Ursprung
5a4d011af5
Commit
4241b49b85
@ -1,62 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaBlend <whizkid3000@hotmail.com>
|
||||
Date: Wed, 21 Sep 2016 20:40:21 -0700
|
||||
Subject: [PATCH] Add hit entity to ProjectileHitEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
+import org.bukkit.entity.Entity; // Paper
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
+import javax.annotation.Nullable;
|
||||
+
|
||||
/**
|
||||
* Called when a projectile hits an object
|
||||
*/
|
||||
public class ProjectileHitEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
+ // Paper start
|
||||
+ @Nullable
|
||||
+ private final Entity hitEntity;
|
||||
|
||||
public ProjectileHitEvent(final Projectile projectile) {
|
||||
+ this(projectile, null);
|
||||
+ }
|
||||
+
|
||||
+ public ProjectileHitEvent(final Projectile projectile, @Nullable final Entity hitEntity) {
|
||||
super(projectile);
|
||||
+ this.hitEntity = hitEntity;
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
@Override
|
||||
public Projectile getEntity() {
|
||||
return (Projectile) entity;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Gets the entity that was hit by the projectile.
|
||||
+ *
|
||||
+ * This may be null, depending on if the projectile
|
||||
+ * actually hit an entity.
|
||||
+ *
|
||||
+ * @return The entity that was hit, or null otherwise
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getHitEntity() {
|
||||
+ return hitEntity;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
--
|
@ -1,77 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: AlphaBlend <whizkid3000@hotmail.com>
|
||||
Date: Wed, 21 Sep 2016 20:40:46 -0700
|
||||
Subject: [PATCH] Add hit entity to ProjectileHitEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 {
|
||||
|
||||
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, entity); // CraftBukkit - Call event // Paper - Include entity in movingobjectposition
|
||||
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);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 {
|
||||
|
||||
// CraftBukkit start - Fire ProjectileHitEvent
|
||||
if (this.dead) {
|
||||
- CraftEventFactory.callProjectileHitEvent(this);
|
||||
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition.entity); // Paper - include entity in movingobjectposition
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 {
|
||||
}
|
||||
|
||||
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.entity); // Craftbukkit - Call event
|
||||
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
|
||||
this.hooked = movingobjectposition.entity;
|
||||
this.s();
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 {
|
||||
this.a(movingobjectposition);
|
||||
// CraftBukkit start
|
||||
if (this.dead) {
|
||||
- org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition.entity); // Paper - include Entity in movingobjectposition
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 {
|
||||
child.world.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
||||
+ public static ProjectileHitEvent callProjectileHitEvent(Entity entity, Entity hitEntity) {
|
||||
+ ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), (hitEntity == null ? null : hitEntity.getBukkitEntity()));
|
||||
+
|
||||
+ entity.world.getServer().getPluginManager().callEvent(event);
|
||||
+ return event;
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
@ -1 +1 @@
|
||||
Subproject commit daec93fe81b52a67e92607649b9b3e7e14d6b905
|
||||
Subproject commit 51d92a748dd56496b173885f6c44ad48da230057
|
@ -1 +1 @@
|
||||
Subproject commit c91ca4a54125b568fbc2f6b792cd68350d5e98da
|
||||
Subproject commit 1c07d5c78f07bf8a5dcc73c6f16f1b9743565b06
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren