From e4d58faf5bb89bb4dd89d713e31431688c760e83 Mon Sep 17 00:00:00 2001 From: Dinnerbone Date: Wed, 21 Sep 2011 00:50:35 +0100 Subject: [PATCH] Fixed NPE when players are killed by (for example) dispensers --- .../server/EntityDamageSourceIndirect.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java diff --git a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java new file mode 100644 index 0000000000..b6d310d3e0 --- /dev/null +++ b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java @@ -0,0 +1,22 @@ +package net.minecraft.server; + +public class EntityDamageSourceIndirect extends EntityDamageSource { + + private Entity n; + + public EntityDamageSourceIndirect(String s, Entity entity, Entity entity1) { + super(s, entity); + this.n = entity1; + } + + public Entity getEntity() { + return this.n; + } + + public String a(EntityHuman entityhuman) { + // CraftBukkit start + String source = (this.n == null) ? "Herobrine" : this.n.Y(); + return StatisticCollector.a("death." + this.m, new Object[] { entityhuman.name, source}); + // CraftBukkit end + } +} \ No newline at end of file