diff --git a/plugin/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewSelfCommand.java b/plugin/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewSelfCommand.java index 7dd3f613..3987749b 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewSelfCommand.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/commands/utils/DisguiseViewSelfCommand.java @@ -44,7 +44,7 @@ public class DisguiseViewSelfCommand implements CommandExecutor { // If they're disguised, tall disguises are hidden, it's a tall disguise // Then tell the player, it's not a bug! The disguise is too tall if (disguise != null && !disguise.isTallDisguisesVisible() && - (!NmsVersion.v1_20_R4.isSupported() || !DisguiseConfig.isTallSelfDisguisesScaling() || + (!NmsVersion.v1_20_R4.isSupported() || !disguise.isTallSelfDisguisesScaling() || (disguise.isMiscDisguise() || disguise.getType() == DisguiseType.ENDER_DRAGON)) && disguise.canSee(player) && DisguiseUtilities.isTallDisguise(disguise)) { LibsMsg.VIEW_SELF_TALL_NOTE.send(player); diff --git a/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java b/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java index 1f4487c7..6e51c12c 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/Disguise.java @@ -133,6 +133,8 @@ public abstract class Disguise { @Getter private boolean scalePlayerToDisguise = DisguiseConfig.isScaleSelfDisguises(); @Getter + private boolean tallSelfDisguisesScaling = DisguiseConfig.isTallSelfDisguisesScaling(); + @Getter private final DisguiseInternals internals; public Disguise(DisguiseType disguiseType) { @@ -521,7 +523,7 @@ public abstract class Disguise { } if (getEntity() instanceof Player && isSelfDisguiseVisible() && !isTallDisguisesVisible() && isTallDisguise()) { - if (DisguiseConfig.isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise()) { + if (isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise()) { adjustTallSelfDisguiseScale(); } else { setSelfDisguiseVisible(false); @@ -550,6 +552,15 @@ public abstract class Disguise { adjustTallSelfDisguiseScale(); } + public void setTallSelfDisguisesScaling(boolean tallSelfDisguisesScaling) { + if (!NmsVersion.v1_20_R4.isSupported()) { + return; + } + + this.tallSelfDisguisesScaling = tallSelfDisguisesScaling; + adjustTallSelfDisguiseScale(); + } + protected void adjustTallSelfDisguiseScale() { if (!canScaleDisguise() || !isDisguiseInUse() || getEntity() == null) { return; @@ -598,7 +609,7 @@ public abstract class Disguise { return; } - if (prevPersonalDisguiseScaleMax != newPersonalDisguiseScaleMax && isSelfDisguiseVisible()) { + if (prevPersonalDisguiseScaleMax != newPersonalDisguiseScaleMax && isSelfDisguiseVisible() && isTallSelfDisguisesScaling()) { double scaleToSend; if (((LivingWatcher) getWatcher()).getScale() != null) { @@ -607,7 +618,9 @@ public abstract class Disguise { scaleToSend = playerScaleWithoutLibsDisguises; } - scaleToSend = Math.min(scaleToSend, newPersonalDisguiseScaleMax); + if (isScalePlayerToDisguise()) { + scaleToSend = Math.min(scaleToSend, newPersonalDisguiseScaleMax); + } // The scale of the self disguise, not the player WrapperPlayServerUpdateAttributes.Property property = @@ -1000,8 +1013,7 @@ public abstract class Disguise { @Deprecated public Disguise setViewSelfDisguise(boolean viewSelfDisguise) { if (viewSelfDisguise && !isTallDisguisesVisible() && isTallDisguise()) { - if (DisguiseConfig.isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise() && - !isPlayerDisguise()) { + if (isTallSelfDisguisesScaling() && NmsVersion.v1_20_R4.isSupported() && canScaleDisguise() && !isPlayerDisguise()) { adjustTallSelfDisguiseScale(); } else { viewSelfDisguise = false; diff --git a/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java b/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java index 26c142e9..27ad9124 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/disguisetypes/watchers/LivingWatcher.java @@ -98,7 +98,7 @@ public class LivingWatcher extends FlagWatcher { Entity entity = getDisguise().getEntity(); for (Player player : DisguiseUtilities.getPerverts(getDisguise())) { - double toSend = player == entity && DisguiseConfig.isTallSelfDisguisesScaling() ? + double toSend = player == entity && getDisguise().isTallSelfDisguisesScaling() ? Math.min(getDisguise().getInternals().getSelfDisguiseTallScaleMax(), scaleToSend) : scaleToSend; WrapperPlayServerUpdateAttributes.Property property = diff --git a/plugin/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerAttributes.java b/plugin/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerAttributes.java index cd1d481a..26f15c9b 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerAttributes.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerAttributes.java @@ -54,7 +54,7 @@ public class PacketHandlerAttributes implements IPacketHandler())); diff --git a/plugin/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java b/plugin/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java index 849874d3..4b4f2302 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerSpawn.java @@ -310,7 +310,7 @@ public class PacketHandlerSpawn implements IPacketHandler { if (NmsVersion.v1_20_R4.isSupported()) { Double scale = ((LivingWatcher) disguise.getWatcher()).getScale(); - if (observer == disguisedEntity && DisguiseConfig.isTallSelfDisguisesScaling()) { + if (observer == disguisedEntity && disguise.isTallSelfDisguisesScaling()) { if (scale == null) { scale = DisguiseUtilities.getEntityScaleWithoutLibsDisguises(observer); } diff --git a/plugin/src/main/java/me/libraryaddict/disguise/utilities/watchers/DisguiseMethods.java b/plugin/src/main/java/me/libraryaddict/disguise/utilities/watchers/DisguiseMethods.java index 65cee898..b738e33f 100644 --- a/plugin/src/main/java/me/libraryaddict/disguise/utilities/watchers/DisguiseMethods.java +++ b/plugin/src/main/java/me/libraryaddict/disguise/utilities/watchers/DisguiseMethods.java @@ -184,6 +184,7 @@ public class DisguiseMethods { if (NmsVersion.v1_20_R4.isSupported()) { extraMethods.add("setScalePlayerToDisguise"); + extraMethods.add("setTallSelfDisguisesScaling"); } // Add these last as it's what we want to present to be called the least