From 8f2c5d6e5496839b700e3a0a7f930bc51dd8bb08 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Thu, 3 Jul 2014 18:34:06 +1200 Subject: [PATCH] Don't add potioneffect when watcher already has a potion effect. Don't compare the length of custom name. But check if its null --- .../disguisetypes/watchers/LivingWatcher.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java index b7a3a244..bb8649f7 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java @@ -53,10 +53,11 @@ public class LivingWatcher extends FlagWatcher { } public void addPotionEffect(PotionEffectType potionEffect) { - if (hasPotionEffect(potionEffect)) + if (!hasPotionEffect(potionEffect)) { removePotionEffect(potionEffect); - potionEffects.add(potionEffect.getId()); - sendPotionEffects(); + potionEffects.add(potionEffect.getId()); + sendPotionEffects(); + } } @Override @@ -115,7 +116,7 @@ public class LivingWatcher extends FlagWatcher { } public boolean hasCustomName() { - return getCustomName().length() > 0; + return getCustomName() != null; } public boolean hasPotionEffect(PotionEffectType type) { @@ -148,8 +149,9 @@ public class LivingWatcher extends FlagWatcher { } public void setCustomName(String name) { - if (name != null && name.length() > 64) + if (name != null && name.length() > 64) { name = name.substring(0, 64); + } setValue(10, name); sendData(10); }