From 5115af60a00e0500a6d1abb2726dd3b329671768 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sun, 7 Sep 2014 03:32:45 +1200 Subject: [PATCH] Move setcustomname and setcustomnamevisible to FlagWatcher --- .../disguise/disguisetypes/FlagWatcher.java | 25 +++++++++++++++++++ .../disguisetypes/watchers/LivingWatcher.java | 25 ------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java index 1cc2c388..0526a8cc 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/FlagWatcher.java @@ -206,6 +206,31 @@ public class FlagWatcher { return getFlag(5); } + public String getCustomName() { + return (String) getValue(10, null); + } + + public boolean hasCustomName() { + return getCustomName() != null; + } + + public boolean isCustomNameVisible() { + return (Byte) getValue(11, (byte) 0) == 1; + } + + public void setCustomName(String name) { + if (name != null && name.length() > 64) { + name = name.substring(0, 64); + } + setValue(10, name); + sendData(10); + } + + public void setCustomNameVisible(boolean display) { + setValue(11, (byte) (display ? 1 : 0)); + sendData(11); + } + public boolean isRightClicking() { return getFlag(4); } diff --git a/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java b/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java index bb8649f7..d15c6395 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java +++ b/src/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java @@ -69,10 +69,6 @@ public class LivingWatcher extends FlagWatcher { return clone; } - public String getCustomName() { - return (String) getValue(10, null); - } - public float getHealth() { return (Float) getValue(6, 0F); } @@ -115,18 +111,10 @@ public class LivingWatcher extends FlagWatcher { return (int) f1 << 16 | (int) f2 << 8 | (int) f3; } - public boolean hasCustomName() { - return getCustomName() != null; - } - public boolean hasPotionEffect(PotionEffectType type) { return potionEffects.contains(type.getId()); } - public boolean isCustomNameVisible() { - return (Byte) getValue(11, (byte) 0) == 1; - } - public boolean isMaxHealthSet() { return maxHealthSet; } @@ -148,19 +136,6 @@ public class LivingWatcher extends FlagWatcher { sendData(7); } - public void setCustomName(String name) { - if (name != null && name.length() > 64) { - name = name.substring(0, 64); - } - setValue(10, name); - sendData(10); - } - - public void setCustomNameVisible(boolean display) { - setValue(11, (byte) (display ? 1 : 0)); - sendData(11); - } - public void setHealth(float health) { setValue(6, health); sendData(6);