diff options
author | feildmaster <admin@feildmaster.com> | 2012-07-29 02:33:13 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2012-08-02 04:58:50 -0500 |
commit | a43d621c0138110d2ec362b2eaa8f938f241bb49 (patch) | |
tree | d2ebc0d7a4a969d3257b1b958236428a24117eb1 /src/main/java/net/minecraft/server/EntityEnderPearl.java | |
parent | 08e2923bd4282579ca0cf7af0e6207cba0591e5c (diff) | |
download | craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.tar craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.tar.gz craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.tar.lz craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.tar.xz craftbukkit-a43d621c0138110d2ec362b2eaa8f938f241bb49.zip |
Update CraftBukkit to Minecraft 1.3.1
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityEnderPearl.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEnderPearl.java | 59 |
1 files changed, 22 insertions, 37 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java index 4878da82..d7351e66 100644 --- a/src/main/java/net/minecraft/server/EntityEnderPearl.java +++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java @@ -17,13 +17,9 @@ public class EntityEnderPearl extends EntityProjectile { super(world, entityliving); } - public EntityEnderPearl(World world, double d0, double d1, double d2) { - super(world, d0, d1, d2); - } - protected void a(MovingObjectPosition movingobjectposition) { - if (movingobjectposition.entity != null && movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0)) { - ; + if (movingobjectposition.entity != null) { + movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.shooter), 0); } for (int i = 0; i < 32; ++i) { @@ -31,46 +27,35 @@ public class EntityEnderPearl extends EntityProjectile { } if (!this.world.isStatic) { - // CraftBukkit start - dupe fix + damage event - boolean teleport = false; - PlayerTeleportEvent teleEvent = null; + if (this.shooter != null && this.shooter instanceof EntityPlayer) { + EntityPlayer entityplayer = (EntityPlayer) this.shooter; - if (this.shooter != null) { - if (this.shooter instanceof EntityPlayer) { + if (!entityplayer.netServerHandler.disconnected && entityplayer.world == this.world) { + // CraftBukkit start CraftPlayer player = (CraftPlayer) this.shooter.bukkitEntity; - teleport = player.isOnline() && player.getWorld() == getBukkitEntity().getWorld(); org.bukkit.Location location = getBukkitEntity().getLocation(); location.setPitch(player.getLocation().getPitch()); location.setYaw(player.getLocation().getYaw()); - if (teleport) { - teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL); - Bukkit.getPluginManager().callEvent(teleEvent); - teleport = !teleEvent.isCancelled(); + PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL); + Bukkit.getPluginManager().callEvent(teleEvent); + if (!teleEvent.isCancelled()) { + ((EntityPlayer) this.shooter).netServerHandler.teleport(teleEvent.getTo()); + this.shooter.fallDistance = 0.0F; + + EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5); + Bukkit.getPluginManager().callEvent(damageEvent); + + if (!damageEvent.isCancelled()) { + org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name); + ((CraftPlayer) bPlayer).getHandle().invulnerableTicks = -1; // Remove spawning invulnerability + bPlayer.setLastDamageCause(damageEvent); + ((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, damageEvent.getDamage()); // Damage the new player instead of the old + } } - } else { - teleport = true; - } - } - - if (teleport) { - if (this.shooter instanceof EntityPlayer) { - ((EntityPlayer) this.shooter).netServerHandler.teleport(teleEvent.getTo()); - } else { - this.shooter.enderTeleportTo(this.locX, this.locY, this.locZ); - } - this.shooter.fallDistance = 0.0F; - EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5); - Bukkit.getPluginManager().callEvent(damageEvent); - - if (!damageEvent.isCancelled()) { - org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name); - ((CraftPlayer) bPlayer).getHandle().invulnerableTicks = -1; // Remove spawning invulnerability. - bPlayer.setLastDamageCause(damageEvent); - ((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, damageEvent.getDamage()); // Damage the new player instead of the old + // CraftBukkit end } } - // CraftBukkit end this.die(); } |