From f535eefabf777da73fecdd04ea5b2340bf63d37e Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Wed, 4 Jun 2014 14:00:08 +1200 Subject: [PATCH] Instead of throwing a error then another error. Just make a FlagWatcher after the first error --- src/me/libraryaddict/disguise/disguisetypes/Disguise.java | 1 - src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java index b4167941..cf6b01aa 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -181,7 +181,6 @@ public abstract class Disguise { private int deadTicks = 0; private int refreshDisguise = 0; - // TODO refactor public void run() { // If entity is no longer valid. Remove it. if (!getEntity().isValid()) { diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index 352c96e1..b24f2b1b 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -68,10 +68,10 @@ public class FlagWatcher { public FlagWatcher clone(Disguise owningDisguise) { FlagWatcher cloned = null; try { - cloned = getClass().getConstructor(Disguise.class).newInstance(owningDisguise); + cloned = getClass().getConstructor(Disguise.class).newInstance(getDisguise()); } catch (Exception e) { - // TODO: This will throw NPE e.printStackTrace(); + cloned = new FlagWatcher(getDisguise()); } cloned.entityValues = (HashMap) entityValues.clone(); cloned.items = items.clone();