Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-16 13:00:06 +01:00
Improve calling of ProjectileHitEvent. Fixes BUKKIT-3872
Dieser Commit ist enthalten in:
Ursprung
45d3e2514d
Commit
08f3df82eb
@ -3,9 +3,7 @@ package net.minecraft.server;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.entity.Projectile;
|
|
||||||
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -209,11 +207,7 @@ public class EntityArrow extends Entity implements IProjectile {
|
|||||||
float f3;
|
float f3;
|
||||||
|
|
||||||
if (movingobjectposition != null) {
|
if (movingobjectposition != null) {
|
||||||
// CraftBukkit start
|
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
|
||||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
|
||||||
ProjectileHitEvent phe = new ProjectileHitEvent(projectile);
|
|
||||||
this.world.getServer().getPluginManager().callEvent(phe);
|
|
||||||
// CraftBukkit end
|
|
||||||
|
|
||||||
if (movingobjectposition.entity != null) {
|
if (movingobjectposition.entity != null) {
|
||||||
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||||
|
@ -2,8 +2,6 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit
|
|
||||||
|
|
||||||
public abstract class EntityFireball extends Entity {
|
public abstract class EntityFireball extends Entity {
|
||||||
|
|
||||||
private int e = -1;
|
private int e = -1;
|
||||||
@ -133,8 +131,7 @@ public abstract class EntityFireball extends Entity {
|
|||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.dead) {
|
if (this.dead) {
|
||||||
ProjectileHitEvent phe = new ProjectileHitEvent((org.bukkit.entity.Projectile) this.getBukkitEntity());
|
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this);
|
||||||
this.world.getServer().getPluginManager().callEvent(phe);
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -178,6 +178,7 @@ public class EntityFishingHook extends Entity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (movingobjectposition != null) {
|
if (movingobjectposition != null) {
|
||||||
|
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
|
||||||
if (movingobjectposition.entity != null) {
|
if (movingobjectposition.entity != null) {
|
||||||
if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0)) {
|
if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0)) {
|
||||||
this.hooked = movingobjectposition.entity;
|
this.hooked = movingobjectposition.entity;
|
||||||
|
@ -2,8 +2,6 @@ package net.minecraft.server;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent; // CraftBukkit
|
|
||||||
|
|
||||||
public abstract class EntityProjectile extends Entity implements IProjectile {
|
public abstract class EntityProjectile extends Entity implements IProjectile {
|
||||||
|
|
||||||
private int blockX = -1;
|
private int blockX = -1;
|
||||||
@ -158,8 +156,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
|
|||||||
this.a(movingobjectposition);
|
this.a(movingobjectposition);
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.dead) {
|
if (this.dead) {
|
||||||
ProjectileHitEvent hitEvent = new ProjectileHitEvent((org.bukkit.entity.Projectile) this.getBukkitEntity());
|
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this);
|
||||||
org.bukkit.Bukkit.getPluginManager().callEvent(hitEvent);
|
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -532,6 +532,12 @@ public class CraftEventFactory {
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ProjectileHitEvent callProjectileHitEvent(Entity entity) {
|
||||||
|
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity());
|
||||||
|
entity.world.getServer().getPluginManager().callEvent(event);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
public static ExpBottleEvent callExpBottleEvent(Entity entity, int exp) {
|
public static ExpBottleEvent callExpBottleEvent(Entity entity, int exp) {
|
||||||
ThrownExpBottle bottle = (ThrownExpBottle) entity.getBukkitEntity();
|
ThrownExpBottle bottle = (ThrownExpBottle) entity.getBukkitEntity();
|
||||||
ExpBottleEvent event = new ExpBottleEvent(bottle, exp);
|
ExpBottleEvent event = new ExpBottleEvent(bottle, exp);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren