Update CraftBukkit to Minecraft 1.3.1
This commit is contained in:
committed by
Travis Watkins
parent
08e2923bd4
commit
a43d621c01
@@ -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,47 +27,36 @@ 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;
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
this.die();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user