From 73e4c3a7c679fd4f22af21b163a6c4e41389d29a Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 23 Nov 2013 09:19:30 +1300 Subject: [PATCH] Renamed another method to be deprecated. Sorted them. --- .../disguise/disguisetypes/Disguise.java | 5 ++++ .../disguise/disguisetypes/MiscDisguise.java | 2 +- .../disguise/disguisetypes/MobDisguise.java | 2 +- .../disguisetypes/PlayerDisguise.java | 2 +- .../disguise/utilities/DisguiseValues.java | 26 +++++++++---------- .../disguise/utilities/PacketsManager.java | 8 +++--- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java index 8837d58d..d3bbecc5 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -41,6 +41,7 @@ public abstract class Disguise { private boolean viewSelfDisguise = DisguiseAPI.isViewDisguises(); private FlagWatcher watcher; + @Deprecated public boolean canHearSelfDisguise() { return hearSelfDisguise; } @@ -333,6 +334,10 @@ public abstract class Disguise { return this instanceof PlayerDisguise; } + public boolean isSelfDisguiseSoundsReplaced() { + return hearSelfDisguise; + } + /** * Can the disguised view himself as the disguise */ diff --git a/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java index 2279c7ab..dba51e30 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/MiscDisguise.java @@ -85,7 +85,7 @@ public class MiscDisguise extends Disguise { public MiscDisguise clone() { MiscDisguise disguise = new MiscDisguise(getType(), isSoundsReplaced(), getData()); disguise.setViewSelfDisguise(isSelfDisguiseVisible()); - disguise.setHearSelfDisguise(canHearSelfDisguise()); + disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced()); disguise.setHideArmorFromSelf(isHidingArmorFromSelf()); disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf()); disguise.setVelocitySent(isVelocitySent()); diff --git a/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java index 785d49cf..b4bca238 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/MobDisguise.java @@ -42,7 +42,7 @@ public class MobDisguise extends Disguise { public MobDisguise clone() { MobDisguise disguise = new MobDisguise(getType(), isAdult(), isSoundsReplaced()); disguise.setViewSelfDisguise(isSelfDisguiseVisible()); - disguise.setHearSelfDisguise(canHearSelfDisguise()); + disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced()); disguise.setHideArmorFromSelf(isHidingArmorFromSelf()); disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf()); disguise.setVelocitySent(isVelocitySent()); diff --git a/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java b/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java index 4e337101..00c7036b 100644 --- a/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java +++ b/src/me/libraryaddict/disguise/disguisetypes/PlayerDisguise.java @@ -18,7 +18,7 @@ public class PlayerDisguise extends Disguise { public PlayerDisguise clone() { PlayerDisguise disguise = new PlayerDisguise(getName(), isSoundsReplaced()); disguise.setViewSelfDisguise(isSelfDisguiseVisible()); - disguise.setHearSelfDisguise(canHearSelfDisguise()); + disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced()); disguise.setHideArmorFromSelf(isHidingArmorFromSelf()); disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf()); disguise.setVelocitySent(isVelocitySent()); diff --git a/src/me/libraryaddict/disguise/utilities/DisguiseValues.java b/src/me/libraryaddict/disguise/utilities/DisguiseValues.java index d60eb43a..0a3cb7c4 100644 --- a/src/me/libraryaddict/disguise/utilities/DisguiseValues.java +++ b/src/me/libraryaddict/disguise/utilities/DisguiseValues.java @@ -8,14 +8,6 @@ public class DisguiseValues { private static HashMap values = new HashMap(); - public static Class getNmsEntityClass(DisguiseType type) { - return getDisguiseValues(type).getNmsEntityClass(); - } - - public static HashMap getMetaValues(DisguiseType type) { - return getDisguiseValues(type).getMetaValues(); - } - public static DisguiseValues getDisguiseValues(DisguiseType type) { switch (type) { case DONKEY: @@ -43,9 +35,17 @@ public class DisguiseValues { return values.get(type); } - private Class nmsEntityClass; + public static HashMap getMetaValues(DisguiseType type) { + return getDisguiseValues(type).getMetaValues(); + } + + public static Class getNmsEntityClass(DisguiseType type) { + return getDisguiseValues(type).getNmsEntityClass(); + } + private int enumEntitySize; private HashMap metaValues = new HashMap(); + private Class nmsEntityClass; public DisguiseValues(DisguiseType type, Class classType, int entitySize) { values.put(type, this); @@ -53,10 +53,6 @@ public class DisguiseValues { nmsEntityClass = classType; } - public Class getNmsEntityClass() { - return nmsEntityClass; - } - public int getEntitySize(double paramDouble) { double d = paramDouble - (((int) Math.floor(paramDouble)) + 0.5D); @@ -104,6 +100,10 @@ public class DisguiseValues { return metaValues; } + public Class getNmsEntityClass() { + return nmsEntityClass; + } + public void setMetaValue(int no, Object value) { metaValues.put(no, value); } diff --git a/src/me/libraryaddict/disguise/utilities/PacketsManager.java b/src/me/libraryaddict/disguise/utilities/PacketsManager.java index 551195f6..47292b24 100644 --- a/src/me/libraryaddict/disguise/utilities/PacketsManager.java +++ b/src/me/libraryaddict/disguise/utilities/PacketsManager.java @@ -446,7 +446,7 @@ public class PacketsManager { } Disguise disguise = DisguiseAPI.getDisguise(disguisedEntity); if (disguise != null) { - if (disguise.canHearSelfDisguise() || disguisedEntity != event.getPlayer()) { + if (disguise.isSelfDisguiseSoundsReplaced() || disguisedEntity != event.getPlayer()) { if (disguise.isSoundsReplaced()) { String sound = null; DisguiseSound dSound = DisguiseSound.getType(disguise.getType().name()); @@ -531,7 +531,7 @@ public class PacketsManager { // It made a damage animation Entity entity = event.getPacket().getEntityModifier(observer.getWorld()).read(0); Disguise disguise = DisguiseAPI.getDisguise(entity); - if (disguise != null && (disguise.canHearSelfDisguise() || entity != event.getPlayer())) { + if (disguise != null && (disguise.isSelfDisguiseSoundsReplaced() || entity != event.getPlayer())) { DisguiseSound disSound = DisguiseSound.getType(entity.getType().name()); if (disSound == null) return; @@ -553,8 +553,8 @@ public class PacketsManager { soundType = SoundType.HURT; } if (disSound.getSound(soundType) == null - || (disguise.canHearSelfDisguise() && entity == event.getPlayer())) { - if (disguise.canHearSelfDisguise() && entity == event.getPlayer()) { + || (disguise.isSelfDisguiseSoundsReplaced() && entity == event.getPlayer())) { + if (disguise.isSelfDisguiseSoundsReplaced() && entity == event.getPlayer()) { cancelSound = !cancelSound; if (cancelSound) return;