Add new config option PlayerHideArmor to fix MM stone items on spawn

This commit is contained in:
libraryaddict 2019-11-27 09:13:12 +13:00
parent d77308dee0
commit 9ecf1cc62c
4 changed files with 18 additions and 2 deletions

View File

@ -84,6 +84,15 @@ public class DisguiseConfig {
private static UpdatesBranch updatesBranch = UpdatesBranch.SAME_BUILDS;
private static int playerDisguisesTablistExpires;
private static boolean dynamicExpiry;
private static boolean playerHideArmor;
public static boolean isPlayerHideArmor() {
return playerHideArmor;
}
public static void setPlayerHideArmor(boolean playerHiddenArmor) {
playerHideArmor = playerHiddenArmor;
}
public static boolean isDynamicExpiry() {
return dynamicExpiry;
@ -340,6 +349,7 @@ public class DisguiseConfig {
setUUIDGeneratedVersion(config.getInt("UUIDVersion"));
setPlayerDisguisesTablistExpires(config.getInt("PlayerDisguisesTablistExpires"));
setDynamicExpiry(config.getBoolean("DynamicExpiry"));
setPlayerHideArmor(config.getBoolean("PlayerHideArmor"));
if (!LibsPremium.isPremium() && (isSavePlayerDisguises() || isSaveEntityDisguises())) {
DisguiseUtilities.getLogger().warning("You must purchase the plugin to use saved disguises!");

View File

@ -39,7 +39,7 @@ public class PacketHandlerEquipment implements IPacketHandler {
@Override
public void handle(Disguise disguise, PacketContainer sentPacket, LibsPackets packets, Player observer,
Entity entity) {
if (packetsHandler.isCancelMeta(disguise, observer)) {
if (DisguiseConfig.isPlayerHideArmor() && packetsHandler.isCancelMeta(disguise, observer)) {
packets.clear();
PacketContainer equipPacket = sentPacket.shallowClone();

View File

@ -380,7 +380,8 @@ public class PacketHandlerSpawn implements IPacketHandler {
// If armor must be sent because its currently not displayed and would've been sent normally
boolean delayedArmor =
(disguise.isPlayerDisguise() && disguisedEntity != observer) && disguisedEntity instanceof LivingEntity;
DisguiseConfig.isPlayerHideArmor() && (disguise.isPlayerDisguise() && disguisedEntity != observer) &&
disguisedEntity instanceof LivingEntity;
// This sends the armor packets so that the player isn't naked.
if (DisguiseConfig.isEquipmentPacketsEnabled() || delayedArmor) {
for (EquipmentSlot slot : EquipmentSlot.values()) {

View File

@ -215,6 +215,11 @@ DisableInvisibility: false
# Expired message can be hidden with an empty translation message
DynamicExpiry: false
# Some players have issues with conflicting plugins where disguised entities will show the wrong armor
# This should be left alone unless you're trying to solve this issue. Such as MM and stone blocks.
# When true, the plugin will hide player disguises armor to prevent a minor visual bug for half a second
PlayerHideArmor: true
# This will help performance, especially with CPU
# Due to safety reasons, self disguises can never have their packets disabled.
PacketsEnabled: