From d6630a0eb531b70afe240603927a24d2437310c7 Mon Sep 17 00:00:00 2001
From: GJ <gjmcferrin@gmail.com>
Date: Wed, 11 Sep 2013 08:51:51 -0400
Subject: [PATCH] Prevent multiple events from being fired.

---
 .../com/gmail/nossr50/listeners/EntityListener.java  | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java
index 65df4e463..04199bcb7 100644
--- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java
+++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java
@@ -199,7 +199,12 @@ public class EntityListener implements Listener {
 
         Entity entity = event.getEntity();
 
-        if (!(entity instanceof LivingEntity)) {
+        if (entity.hasMetadata(mcMMO.customDamageKey)) {
+            entity.removeMetadata(mcMMO.customDamageKey, plugin);
+            return;
+        }
+
+        if (Misc.isNPCEntity(entity) || !entity.isValid() || !(entity instanceof LivingEntity)) {
             return;
         }
 
@@ -213,11 +218,6 @@ public class EntityListener implements Listener {
 
         if (livingEntity instanceof Player) {
             Player player = (Player) entity;
-
-            if (Misc.isNPCEntity(player)) {
-                return;
-            }
-
             McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
 
             /* Check for invincibility */