Renamed another method to be deprecated. Sorted them.

This commit is contained in:
libraryaddict 2013-11-23 09:19:30 +13:00
parent 0a98e90afc
commit 73e4c3a7c6
6 changed files with 25 additions and 20 deletions

View File

@ -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
*/

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -8,14 +8,6 @@ public class DisguiseValues {
private static HashMap<DisguiseType, DisguiseValues> values = new HashMap<DisguiseType, DisguiseValues>();
public static Class getNmsEntityClass(DisguiseType type) {
return getDisguiseValues(type).getNmsEntityClass();
}
public static HashMap<Integer, Object> 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<Integer, Object> getMetaValues(DisguiseType type) {
return getDisguiseValues(type).getMetaValues();
}
public static Class getNmsEntityClass(DisguiseType type) {
return getDisguiseValues(type).getNmsEntityClass();
}
private int enumEntitySize;
private HashMap<Integer, Object> metaValues = new HashMap<Integer, Object>();
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);
}

View File

@ -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;