diff options
author | feildmaster <admin@feildmaster.com> | 2012-08-22 14:17:36 -0500 |
---|---|---|
committer | feildmaster <admin@feildmaster.com> | 2012-08-22 14:32:10 -0500 |
commit | 8fdb006143f34a5bbfaadf4d1677ac7fb40403fb (patch) | |
tree | 75cd36a75104b726a7eb5c857ce6ff63d07aadc6 /src/main/java/net/minecraft | |
parent | 98c98d0f7aee6a5bf26fd04053d018c4b62dd2b0 (diff) | |
download | craftbukkit-8fdb006143f34a5bbfaadf4d1677ac7fb40403fb.tar craftbukkit-8fdb006143f34a5bbfaadf4d1677ac7fb40403fb.tar.gz craftbukkit-8fdb006143f34a5bbfaadf4d1677ac7fb40403fb.tar.lz craftbukkit-8fdb006143f34a5bbfaadf4d1677ac7fb40403fb.tar.xz craftbukkit-8fdb006143f34a5bbfaadf4d1677ac7fb40403fb.zip |
Use constant Player for EnderPearls
Also make sure players are online before proceeding to each event
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEnderPearl.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java index d7351e66..dd8d722b 100644 --- a/src/main/java/net/minecraft/server/EntityEnderPearl.java +++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java @@ -32,25 +32,25 @@ public class EntityEnderPearl extends EntityProjectile { if (!entityplayer.netServerHandler.disconnected && entityplayer.world == this.world) { // CraftBukkit start - CraftPlayer player = (CraftPlayer) this.shooter.bukkitEntity; + CraftPlayer player = entityplayer.getBukkitEntity(); org.bukkit.Location location = getBukkitEntity().getLocation(); location.setPitch(player.getLocation().getPitch()); location.setYaw(player.getLocation().getYaw()); 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()); + + if (!teleEvent.isCancelled() && !entityplayer.netServerHandler.disconnected) { + entityplayer.netServerHandler.teleport(teleEvent.getTo()); this.shooter.fallDistance = 0.0F; - EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5); + EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), player, 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 + if (!damageEvent.isCancelled() && !entityplayer.netServerHandler.disconnected) { + entityplayer.invulnerableTicks = -1; // Remove spawning invulnerability + player.setLastDamageCause(damageEvent); + entityplayer.damageEntity(DamageSource.FALL, damageEvent.getDamage()); } } // CraftBukkit end |