diff options
author | EvilSeph <evilseph@gmail.com> | 2011-12-11 00:52:55 -0500 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-12-11 02:13:48 -0500 |
commit | 88d1512507664f41d7f164fb10a21a851f5ca8d7 (patch) | |
tree | 3c6452c578425c0cfd179d68fad5fd92b5782692 /src/main/java/net/minecraft | |
parent | 77c07095bd86c30bb28ab8783e073c8dbd542f54 (diff) | |
download | craftbukkit-88d1512507664f41d7f164fb10a21a851f5ca8d7.tar craftbukkit-88d1512507664f41d7f164fb10a21a851f5ca8d7.tar.gz craftbukkit-88d1512507664f41d7f164fb10a21a851f5ca8d7.tar.lz craftbukkit-88d1512507664f41d7f164fb10a21a851f5ca8d7.tar.xz craftbukkit-88d1512507664f41d7f164fb10a21a851f5ca8d7.zip |
Fixed issues with Ender Pearls. This fixes BUKKIT-248 and BUKKIT-264.
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityEnderPearl.java | 11 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/EntityPlayer.java | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java index 04f7db9d..21d17724 100644 --- a/src/main/java/net/minecraft/server/EntityEnderPearl.java +++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java @@ -2,8 +2,7 @@ package net.minecraft.server; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.entity.CraftPlayer; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.player.PlayerPortalEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.player.PlayerTeleportEvent; public class EntityEnderPearl extends EntityProjectile { @@ -37,7 +36,7 @@ public class EntityEnderPearl extends EntityProjectile { if (this.shooter instanceof EntityPlayer) { CraftPlayer player = (CraftPlayer)this.shooter.bukkitEntity; teleport = player.isOnline(); - + if (teleport) { teleEvent = new PlayerTeleportEvent(player, player.getLocation(), getBukkitEntity().getLocation(), PlayerTeleportEvent.TeleportCause.ENDER_PEARL); Bukkit.getPluginManager().callEvent(teleEvent); @@ -55,11 +54,13 @@ public class EntityEnderPearl extends EntityProjectile { this.shooter.a_(this.locX, this.locY, this.locZ); } this.shooter.fallDistance = 0.0F; - EntityDamageEvent damageEvent = new EntityDamageEvent(getBukkitEntity(), EntityDamageEvent.DamageCause.FALL, 5); + EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), this.shooter.getBukkitEntity(), EntityDamageByEntityEvent.DamageCause.FALL, 5); Bukkit.getPluginManager().callEvent(damageEvent); if (!damageEvent.isCancelled()) { - this.shooter.damageEntity(DamageSource.FALL, damageEvent.getDamage()); + org.bukkit.entity.Player bPlayer = Bukkit.getPlayerExact(((EntityPlayer) this.shooter).name); + ((CraftPlayer) bPlayer).getHandle().cg = -1; // Remove spawning invulnerability. + ((CraftPlayer) bPlayer).getHandle().damageEntity(DamageSource.FALL, 5); // Damage the new player instead of the old } } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 93b4b541..8f1ac3bc 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -28,7 +28,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { private int cd = -99999999; private boolean ce = true; public int cf = -99999999; // Craftbukkit - priv to pub - "lastSentExp" - private int cg = 60; + public int cg = 60; // CraftBukkit - private to public; temporary until we get an API out private ItemStack[] ch = new ItemStack[] { null, null, null, null, null}; private int ci = 0; public boolean h; |