diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2014-05-26 19:28:11 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-05-26 19:34:45 -0500 |
commit | 38fbe60d4689ff026f09767ac9a5656da0549c2d (patch) | |
tree | 47f7ca735b0c37f42306335b3cdf3b83522563d8 /src/main/java/net/minecraft/server | |
parent | 3fbf4d3b5f3c5b74b73ba761ec278c9bdff448f5 (diff) | |
download | craftbukkit-38fbe60d4689ff026f09767ac9a5656da0549c2d.tar craftbukkit-38fbe60d4689ff026f09767ac9a5656da0549c2d.tar.gz craftbukkit-38fbe60d4689ff026f09767ac9a5656da0549c2d.tar.lz craftbukkit-38fbe60d4689ff026f09767ac9a5656da0549c2d.tar.xz craftbukkit-38fbe60d4689ff026f09767ac9a5656da0549c2d.zip |
Handle null targets in target event. Fixes BUKKIT-5635
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityIronGolem.java | 6 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/EntityZombie.java | 7 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java index 1f557a8a..c357110f 100644 --- a/src/main/java/net/minecraft/server/EntityIronGolem.java +++ b/src/main/java/net/minecraft/server/EntityIronGolem.java @@ -64,7 +64,11 @@ public class EntityIronGolem extends EntityGolem { // CraftBukkit start org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this, (EntityLiving) entity, org.bukkit.event.entity.EntityTargetEvent.TargetReason.COLLISION); if (!event.isCancelled()) { - this.setGoalTarget(((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getTarget()).getHandle()); + if (event.getTarget() == null) { + this.setGoalTarget(null); + } else { + this.setGoalTarget(((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getTarget()).getHandle()); + } } // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 58666de6..89fc4c5d 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -191,9 +191,12 @@ public class EntityZombie extends EntityMonster { this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit // CraftBukkit start - call EntityTargetEvent org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(entityzombie, entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET); - entityliving = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getTarget()).getHandle(); if (!event.isCancelled()) { - entityzombie.setGoalTarget(entityliving); + if (event.getTarget() == null) { + entityzombie.setGoalTarget(null); + } else { + entityzombie.setGoalTarget(((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getTarget()).getHandle()); + } } // CraftBukkit end entityzombie.a((GroupDataEntity) null); |