mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-15 15:28:36 +01:00
Deprecate the replaceSounds and add new constructors for miscDisguise
This commit is contained in:
parent
b7dfb2c66b
commit
8db338f533
@ -54,7 +54,7 @@ public abstract class Disguise {
|
||||
/**
|
||||
* Seems I do this method so I can make cleaner constructors on disguises..
|
||||
*/
|
||||
protected void createDisguise(DisguiseType newType, boolean doSounds) {
|
||||
protected void createDisguise(DisguiseType newType) {
|
||||
if (getWatcher() != null)
|
||||
return;
|
||||
if (newType.getEntityType() == null) {
|
||||
@ -65,8 +65,6 @@ public abstract class Disguise {
|
||||
}
|
||||
// Set the disguise type
|
||||
disguiseType = newType;
|
||||
// Set the option to replace the sounds
|
||||
setReplaceSounds(doSounds);
|
||||
// Get if they are a adult now..
|
||||
boolean isAdult = true;
|
||||
if (isMobDisguise()) {
|
||||
|
@ -16,21 +16,33 @@ public class MiscDisguise extends TargetedDisguise {
|
||||
private int id = -1;
|
||||
|
||||
public MiscDisguise(DisguiseType disguiseType) {
|
||||
this(disguiseType, true, -1, -1);
|
||||
this(disguiseType, -1, -1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public MiscDisguise(DisguiseType disguiseType, boolean replaceSounds) {
|
||||
this(disguiseType, replaceSounds, -1, -1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public MiscDisguise(DisguiseType disguiseType, boolean replaceSounds, int addictionalData) {
|
||||
this(disguiseType, replaceSounds, (disguiseType == DisguiseType.FALLING_BLOCK
|
||||
|| disguiseType == DisguiseType.DROPPED_ITEM ? addictionalData : -1), (disguiseType == DisguiseType.FALLING_BLOCK
|
||||
|| disguiseType == DisguiseType.DROPPED_ITEM ? -1 : addictionalData));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public MiscDisguise(DisguiseType disguiseType, boolean replaceSounds, int id, int data) {
|
||||
createDisguise(disguiseType, replaceSounds);
|
||||
this(disguiseType, id, data);
|
||||
this.setReplaceSounds(replaceSounds);
|
||||
}
|
||||
|
||||
public MiscDisguise(DisguiseType disguiseType, int id) {
|
||||
this(disguiseType, id, -1);
|
||||
}
|
||||
|
||||
public MiscDisguise(DisguiseType disguiseType, int id, int data) {
|
||||
createDisguise(disguiseType);
|
||||
switch (disguiseType) {
|
||||
// The only disguises which should use a custom data.
|
||||
case FISHING_HOOK:
|
||||
@ -46,6 +58,7 @@ public class MiscDisguise extends TargetedDisguise {
|
||||
data = -1;
|
||||
break;
|
||||
}
|
||||
// Only falling block should set the id
|
||||
if (getType() == DisguiseType.FALLING_BLOCK && id != -1) {
|
||||
this.id = id;
|
||||
} else {
|
||||
@ -79,13 +92,14 @@ public class MiscDisguise extends TargetedDisguise {
|
||||
}
|
||||
}
|
||||
|
||||
public MiscDisguise(DisguiseType disguiseType, int id, int data) {
|
||||
this(disguiseType, true, id, data);
|
||||
@Deprecated
|
||||
public MiscDisguise(EntityType entityType) {
|
||||
this(entityType, -1, -1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public MiscDisguise(EntityType entityType) {
|
||||
this(entityType, true, -1, -1);
|
||||
public MiscDisguise(EntityType entityType, int id) {
|
||||
this(entityType, id, -1);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -100,12 +114,13 @@ public class MiscDisguise extends TargetedDisguise {
|
||||
|
||||
@Deprecated
|
||||
public MiscDisguise(EntityType disguiseType, int id, int data) {
|
||||
this(disguiseType, true, id, data);
|
||||
this(DisguiseType.getType(disguiseType), id, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MiscDisguise clone() {
|
||||
MiscDisguise disguise = new MiscDisguise(getType(), isSoundsReplaced(), getData());
|
||||
MiscDisguise disguise = new MiscDisguise(getType(), getData());
|
||||
disguise.setReplaceSounds(isSoundsReplaced());
|
||||
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
||||
disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced());
|
||||
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
||||
|
@ -14,12 +14,14 @@ public class MobDisguise extends TargetedDisguise {
|
||||
}
|
||||
|
||||
public MobDisguise(DisguiseType disguiseType, boolean isAdult) {
|
||||
this(disguiseType, isAdult, true);
|
||||
this.isAdult = isAdult;
|
||||
createDisguise(disguiseType);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public MobDisguise(DisguiseType disguiseType, boolean isAdult, boolean replaceSounds) {
|
||||
this.isAdult = isAdult;
|
||||
createDisguise(disguiseType, replaceSounds);
|
||||
this(disguiseType, isAdult);
|
||||
this.setReplaceSounds(replaceSounds);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@ -29,18 +31,19 @@ public class MobDisguise extends TargetedDisguise {
|
||||
|
||||
@Deprecated
|
||||
public MobDisguise(EntityType entityType, boolean isAdult) {
|
||||
this(entityType, isAdult, true);
|
||||
this(DisguiseType.getType(entityType), isAdult);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public MobDisguise(EntityType entityType, boolean isAdult, boolean replaceSounds) {
|
||||
this.isAdult = isAdult;
|
||||
createDisguise(DisguiseType.getType(entityType), replaceSounds);
|
||||
this(entityType, isAdult);
|
||||
this.setReplaceSounds(replaceSounds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobDisguise clone() {
|
||||
MobDisguise disguise = new MobDisguise(getType(), isAdult(), isSoundsReplaced());
|
||||
MobDisguise disguise = new MobDisguise(getType(), isAdult());
|
||||
disguise.setReplaceSounds(isSoundsReplaced());
|
||||
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
||||
disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced());
|
||||
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
||||
|
@ -4,19 +4,22 @@ public class PlayerDisguise extends TargetedDisguise {
|
||||
private String playerName;
|
||||
|
||||
public PlayerDisguise(String name) {
|
||||
this(name, true);
|
||||
}
|
||||
|
||||
public PlayerDisguise(String name, boolean replaceSounds) {
|
||||
if (name.length() > 16)
|
||||
name = name.substring(0, 16);
|
||||
playerName = name;
|
||||
createDisguise(DisguiseType.PLAYER, replaceSounds);
|
||||
createDisguise(DisguiseType.PLAYER);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public PlayerDisguise(String name, boolean replaceSounds) {
|
||||
this(name);
|
||||
this.setReplaceSounds(replaceSounds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerDisguise clone() {
|
||||
PlayerDisguise disguise = new PlayerDisguise(getName(), isSoundsReplaced());
|
||||
PlayerDisguise disguise = new PlayerDisguise(getName());
|
||||
disguise.setReplaceSounds(isSoundsReplaced());
|
||||
disguise.setViewSelfDisguise(isSelfDisguiseVisible());
|
||||
disguise.setHearSelfDisguise(isSelfDisguiseSoundsReplaced());
|
||||
disguise.setHideArmorFromSelf(isHidingArmorFromSelf());
|
||||
|
@ -2,6 +2,7 @@ package me.libraryaddict.disguise.disguisetypes.watchers;
|
||||
|
||||
import me.libraryaddict.disguise.disguisetypes.Disguise;
|
||||
import me.libraryaddict.disguise.disguisetypes.FlagWatcher;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class DroppedItemWatcher extends FlagWatcher {
|
||||
|
Loading…
Reference in New Issue
Block a user