Add a option to only remove the disguise when it is invalid, only remove the current disguise.
This commit is contained in:
parent
1ba39f8920
commit
789740c358
@ -37,6 +37,7 @@ public abstract class Disguise {
|
|||||||
private boolean hideArmorFromSelf = DisguiseConfig.isHidingArmorFromSelf();
|
private boolean hideArmorFromSelf = DisguiseConfig.isHidingArmorFromSelf();
|
||||||
private boolean hideHeldItemFromSelf = DisguiseConfig.isHidingHeldItemFromSelf();
|
private boolean hideHeldItemFromSelf = DisguiseConfig.isHidingHeldItemFromSelf();
|
||||||
private boolean modifyBoundingBox = DisguiseConfig.isModifyBoundingBox();
|
private boolean modifyBoundingBox = DisguiseConfig.isModifyBoundingBox();
|
||||||
|
private boolean removeWhenInvalid;
|
||||||
private boolean replaceSounds = DisguiseConfig.isSoundEnabled();
|
private boolean replaceSounds = DisguiseConfig.isSoundEnabled();
|
||||||
private BukkitRunnable velocityRunnable;
|
private BukkitRunnable velocityRunnable;
|
||||||
private boolean velocitySent = DisguiseConfig.isVelocitySent();
|
private boolean velocitySent = DisguiseConfig.isVelocitySent();
|
||||||
@ -184,7 +185,9 @@ public abstract class Disguise {
|
|||||||
public void run() {
|
public void run() {
|
||||||
// If entity is no longer valid. Remove it.
|
// If entity is no longer valid. Remove it.
|
||||||
if (!getEntity().isValid()) {
|
if (!getEntity().isValid()) {
|
||||||
DisguiseAPI.undisguiseToAll(getEntity());
|
if (isRemoveWhenInvalid()) {
|
||||||
|
removeDisguise();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// If the disguise type is tnt, we need to resend the entity packet else it will turn invisible
|
// If the disguise type is tnt, we need to resend the entity packet else it will turn invisible
|
||||||
if (getType() == DisguiseType.PRIMED_TNT || getType() == DisguiseType.FIREWORK) {
|
if (getType() == DisguiseType.PRIMED_TNT || getType() == DisguiseType.FIREWORK) {
|
||||||
@ -326,6 +329,10 @@ public abstract class Disguise {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isRemoveWhenInvalid() {
|
||||||
|
return !removeWhenInvalid;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSelfDisguiseSoundsReplaced() {
|
public boolean isSelfDisguiseSoundsReplaced() {
|
||||||
return hearSelfDisguise;
|
return hearSelfDisguise;
|
||||||
}
|
}
|
||||||
@ -432,6 +439,10 @@ public abstract class Disguise {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRemoveDisguiseWhenInvalid(boolean removeWhenInvalid) {
|
||||||
|
this.removeWhenInvalid = removeWhenInvalid;
|
||||||
|
}
|
||||||
|
|
||||||
public void setReplaceSounds(boolean areSoundsReplaced) {
|
public void setReplaceSounds(boolean areSoundsReplaced) {
|
||||||
replaceSounds = areSoundsReplaced;
|
replaceSounds = areSoundsReplaced;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user