Renamed another method to be deprecated. Sorted them.
This commit is contained in:
parent
0a98e90afc
commit
73e4c3a7c6
@ -41,6 +41,7 @@ public abstract class Disguise {
|
|||||||
private boolean viewSelfDisguise = DisguiseAPI.isViewDisguises();
|
private boolean viewSelfDisguise = DisguiseAPI.isViewDisguises();
|
||||||
private FlagWatcher watcher;
|
private FlagWatcher watcher;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public boolean canHearSelfDisguise() {
|
public boolean canHearSelfDisguise() {
|
||||||
return hearSelfDisguise;
|
return hearSelfDisguise;
|
||||||
}
|
}
|
||||||
@ -333,6 +334,10 @@ public abstract class Disguise {
|
|||||||
return this instanceof PlayerDisguise;
|
return this instanceof PlayerDisguise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSelfDisguiseSoundsReplaced() {
|
||||||
|
return hearSelfDisguise;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the disguised view himself as the disguise
|
* Can the disguised view himself as the disguise
|
||||||
*/
|
*/
|
||||||
|
@ -85,7 +85,7 @@ public class MiscDisguise extends Disguise {
|
|||||||
public MiscDisguise clone() {
|
public MiscDisguise clone() {
|
||||||
MiscDisguise disguise = new MiscDisguise(getType(), isSoundsReplaced(), getData());
|
MiscDisguise disguise = new MiscDisguise(getType(), isSoundsReplaced(), getData());
|
||||||
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
||||||
disguise.setHearSelfDisguise(canHearSelfDisguise());
|
disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced());
|
||||||
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
||||||
disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf());
|
disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf());
|
||||||
disguise.setVelocitySent(isVelocitySent());
|
disguise.setVelocitySent(isVelocitySent());
|
||||||
|
@ -42,7 +42,7 @@ public class MobDisguise extends Disguise {
|
|||||||
public MobDisguise clone() {
|
public MobDisguise clone() {
|
||||||
MobDisguise disguise = new MobDisguise(getType(), isAdult(), isSoundsReplaced());
|
MobDisguise disguise = new MobDisguise(getType(), isAdult(), isSoundsReplaced());
|
||||||
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
||||||
disguise.setHearSelfDisguise(canHearSelfDisguise());
|
disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced());
|
||||||
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
||||||
disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf());
|
disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf());
|
||||||
disguise.setVelocitySent(isVelocitySent());
|
disguise.setVelocitySent(isVelocitySent());
|
||||||
|
@ -18,7 +18,7 @@ public class PlayerDisguise extends Disguise {
|
|||||||
public PlayerDisguise clone() {
|
public PlayerDisguise clone() {
|
||||||
PlayerDisguise disguise = new PlayerDisguise(getName(), isSoundsReplaced());
|
PlayerDisguise disguise = new PlayerDisguise(getName(), isSoundsReplaced());
|
||||||
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
||||||
disguise.setHearSelfDisguise(canHearSelfDisguise());
|
disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced());
|
||||||
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
||||||
disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf());
|
disguise.setHideHeldItemFromSelf(isHidingHeldItemFromSelf());
|
||||||
disguise.setVelocitySent(isVelocitySent());
|
disguise.setVelocitySent(isVelocitySent());
|
||||||
|
@ -8,14 +8,6 @@ public class DisguiseValues {
|
|||||||
|
|
||||||
private static HashMap<DisguiseType, DisguiseValues> values = new HashMap<DisguiseType, 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) {
|
public static DisguiseValues getDisguiseValues(DisguiseType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DONKEY:
|
case DONKEY:
|
||||||
@ -43,9 +35,17 @@ public class DisguiseValues {
|
|||||||
return values.get(type);
|
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 int enumEntitySize;
|
||||||
private HashMap<Integer, Object> metaValues = new HashMap<Integer, Object>();
|
private HashMap<Integer, Object> metaValues = new HashMap<Integer, Object>();
|
||||||
|
private Class nmsEntityClass;
|
||||||
|
|
||||||
public DisguiseValues(DisguiseType type, Class classType, int entitySize) {
|
public DisguiseValues(DisguiseType type, Class classType, int entitySize) {
|
||||||
values.put(type, this);
|
values.put(type, this);
|
||||||
@ -53,10 +53,6 @@ public class DisguiseValues {
|
|||||||
nmsEntityClass = classType;
|
nmsEntityClass = classType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class getNmsEntityClass() {
|
|
||||||
return nmsEntityClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getEntitySize(double paramDouble) {
|
public int getEntitySize(double paramDouble) {
|
||||||
double d = paramDouble - (((int) Math.floor(paramDouble)) + 0.5D);
|
double d = paramDouble - (((int) Math.floor(paramDouble)) + 0.5D);
|
||||||
|
|
||||||
@ -104,6 +100,10 @@ public class DisguiseValues {
|
|||||||
return metaValues;
|
return metaValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Class getNmsEntityClass() {
|
||||||
|
return nmsEntityClass;
|
||||||
|
}
|
||||||
|
|
||||||
public void setMetaValue(int no, Object value) {
|
public void setMetaValue(int no, Object value) {
|
||||||
metaValues.put(no, value);
|
metaValues.put(no, value);
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ public class PacketsManager {
|
|||||||
}
|
}
|
||||||
Disguise disguise = DisguiseAPI.getDisguise(disguisedEntity);
|
Disguise disguise = DisguiseAPI.getDisguise(disguisedEntity);
|
||||||
if (disguise != null) {
|
if (disguise != null) {
|
||||||
if (disguise.canHearSelfDisguise() || disguisedEntity != event.getPlayer()) {
|
if (disguise.isSelfDisguiseSoundsReplaced() || disguisedEntity != event.getPlayer()) {
|
||||||
if (disguise.isSoundsReplaced()) {
|
if (disguise.isSoundsReplaced()) {
|
||||||
String sound = null;
|
String sound = null;
|
||||||
DisguiseSound dSound = DisguiseSound.getType(disguise.getType().name());
|
DisguiseSound dSound = DisguiseSound.getType(disguise.getType().name());
|
||||||
@ -531,7 +531,7 @@ public class PacketsManager {
|
|||||||
// It made a damage animation
|
// It made a damage animation
|
||||||
Entity entity = event.getPacket().getEntityModifier(observer.getWorld()).read(0);
|
Entity entity = event.getPacket().getEntityModifier(observer.getWorld()).read(0);
|
||||||
Disguise disguise = DisguiseAPI.getDisguise(entity);
|
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());
|
DisguiseSound disSound = DisguiseSound.getType(entity.getType().name());
|
||||||
if (disSound == null)
|
if (disSound == null)
|
||||||
return;
|
return;
|
||||||
@ -553,8 +553,8 @@ public class PacketsManager {
|
|||||||
soundType = SoundType.HURT;
|
soundType = SoundType.HURT;
|
||||||
}
|
}
|
||||||
if (disSound.getSound(soundType) == null
|
if (disSound.getSound(soundType) == null
|
||||||
|| (disguise.canHearSelfDisguise() && entity == event.getPlayer())) {
|
|| (disguise.isSelfDisguiseSoundsReplaced() && entity == event.getPlayer())) {
|
||||||
if (disguise.canHearSelfDisguise() && entity == event.getPlayer()) {
|
if (disguise.isSelfDisguiseSoundsReplaced() && entity == event.getPlayer()) {
|
||||||
cancelSound = !cancelSound;
|
cancelSound = !cancelSound;
|
||||||
if (cancelSound)
|
if (cancelSound)
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user