geforkt von Mirrors/Paper
cleanup of projectiles
Dieser Commit ist enthalten in:
Ursprung
a1ad0c0103
Commit
9455ff1777
@ -3,7 +3,6 @@ package net.minecraft.server;
|
||||
import java.util.List;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
@ -190,15 +189,11 @@ public class EntityArrow extends Entity {
|
||||
if (entity instanceof EntityLiving) {
|
||||
org.bukkit.Server server = this.world.getServer();
|
||||
|
||||
// TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
|
||||
// or leave as DamageCause.ENTITY_ATTACK
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
// TODO deal with arrows being fired from a non-entity
|
||||
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, l);
|
||||
server.getPluginManager().callEvent(event);
|
||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
||||
|
||||
if (event.isCancelled()) {
|
||||
stick = !projectile.doesBounce();
|
||||
|
@ -35,7 +35,6 @@ public class EntityEgg extends EntityProjectile {
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
|
@ -191,12 +191,9 @@ public class EntityFireball extends Entity {
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
||||
|
||||
if (event.isCancelled()) {
|
||||
stick = !projectile.doesBounce();
|
||||
} else {
|
||||
|
@ -190,13 +190,11 @@ public class EntityFishingHook extends Entity {
|
||||
if (movingobjectposition != null) {
|
||||
if (movingobjectposition.entity != null) {
|
||||
// CraftBukkit start
|
||||
// TODO add EntityDamagedByProjectileEvent : fishing hook?
|
||||
boolean stick;
|
||||
if (movingobjectposition.entity instanceof EntityLiving) {
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
@ -204,7 +202,7 @@ public class EntityFishingHook extends Entity {
|
||||
stick = !projectile.doesBounce();
|
||||
} else {
|
||||
// this function returns if the fish should stick in or not, i.e. !bounce
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile((Entity) this, this.owner), event.getDamage());
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), event.getDamage());
|
||||
}
|
||||
} else {
|
||||
stick = movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0);
|
||||
|
@ -39,7 +39,6 @@ public class EntitySnowball extends EntityProjectile {
|
||||
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
|
||||
Projectile projectile = (Projectile) this.getBukkitEntity();
|
||||
|
||||
// TODO @see EntityArrow#162
|
||||
EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, b0);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
this.shooter = (projectile.getShooter() == null) ? null : ((CraftLivingEntity) projectile.getShooter()).getHandle();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren