diff --git a/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java b/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java index d2a3671b..a7dd0894 100644 --- a/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java +++ b/src/main/java/me/libraryaddict/disguise/DisguiseConfig.java @@ -397,7 +397,8 @@ public class DisguiseConfig { setEntityStatusPacketsEnabled(config.getBoolean("PacketsEnabled.EntityStatus")); setEquipmentPacketsEnabled(config.getBoolean("PacketsEnabled.Equipment")); setExplicitDisguisePermissions(config.getBoolean("Permissions.ExplicitDisguises")); - setExtendedDisguiseNames(config.getBoolean("ExtendedNames")); + // The default value shall be false if you don't update config + setExtendedDisguiseNames(config.contains("ScoreboardNames") && config.getBoolean("ExtendedNames")); setHideArmorFromSelf(config.getBoolean("RemoveArmor")); setHideDisguisedPlayers(config.getBoolean("HideDisguisedPlayersFromTab")); setHideHeldItemFromSelf(config.getBoolean("RemoveHeldItem")); diff --git a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerAttributes.java b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerAttributes.java index e9ee0954..c5e282ed 100644 --- a/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerAttributes.java +++ b/src/main/java/me/libraryaddict/disguise/utilities/packets/packethandlers/PacketHandlerAttributes.java @@ -50,47 +50,48 @@ public class PacketHandlerAttributes implements IPacketHandler { return; } - if (!disguise.isMiscDisguise()) { - packets.clear(); + if (disguise.isMiscDisguise()) { + return; + } - List attributes = new ArrayList<>(); - PacketContainer updateAttributes = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES); + packets.clear(); - for (WrappedAttribute attribute : sentPacket.getAttributeCollectionModifier().read(0)) { - if (attribute.getAttributeKey().equals("generic.maxHealth")) { - WrappedAttribute.Builder builder; + List attributes = new ArrayList<>(); + PacketContainer updateAttributes = new PacketContainer(PacketType.Play.Server.UPDATE_ATTRIBUTES); - if (((LivingWatcher) disguise.getWatcher()).isMaxHealthSet()) { - builder = WrappedAttribute.newBuilder(); - builder.attributeKey("generic.maxHealth"); - builder.baseValue(((LivingWatcher) disguise.getWatcher()).getMaxHealth()); - } else if (DisguiseConfig.isMaxHealthDeterminedByDisguisedEntity()) { - builder = WrappedAttribute.newBuilder(attribute); - } else { - builder = WrappedAttribute.newBuilder(); - builder.attributeKey("generic.maxHealth"); - builder.baseValue( - DisguiseValues.getDisguiseValues(disguise.getType()).getMaxHealth()); - } + for (WrappedAttribute attribute : sentPacket.getAttributeCollectionModifier().read(0)) { + if (attribute.getAttributeKey().equals("generic.maxHealth")) { + WrappedAttribute.Builder builder; - builder.packet(updateAttributes); - - attributes.add(builder.build()); - } else if (attribute.getAttributeKey().equals("generic.movementSpeed") && - disguise.getWatcher() instanceof AbstractHorseWatcher) { - WrappedAttribute.Builder builder = WrappedAttribute.newBuilder(attribute); - builder.packet(updateAttributes); - - attributes.add(builder.build()); + if (((LivingWatcher) disguise.getWatcher()).isMaxHealthSet()) { + builder = WrappedAttribute.newBuilder(); + builder.attributeKey("generic.maxHealth"); + builder.baseValue(((LivingWatcher) disguise.getWatcher()).getMaxHealth()); + } else if (DisguiseConfig.isMaxHealthDeterminedByDisguisedEntity()) { + builder = WrappedAttribute.newBuilder(attribute); + } else { + builder = WrappedAttribute.newBuilder(); + builder.attributeKey("generic.maxHealth"); + builder.baseValue(DisguiseValues.getDisguiseValues(disguise.getType()).getMaxHealth()); } - } - if (!attributes.isEmpty()) { - packets.addPacket(updateAttributes); + builder.packet(updateAttributes); - updateAttributes.getIntegers().write(0, entity.getEntityId()); - updateAttributes.getAttributeCollectionModifier().write(0, attributes); + attributes.add(builder.build()); + } else if (attribute.getAttributeKey().equals("generic.movementSpeed") && + disguise.getWatcher() instanceof AbstractHorseWatcher) { + WrappedAttribute.Builder builder = WrappedAttribute.newBuilder(attribute); + builder.packet(updateAttributes); + + attributes.add(builder.build()); } } + + if (!attributes.isEmpty()) { + packets.addPacket(updateAttributes); + + updateAttributes.getIntegers().write(0, entity.getEntityId()); + updateAttributes.getAttributeCollectionModifier().write(0, attributes); + } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 3a2160eb..e50ec521 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -63,7 +63,7 @@ SaveDisguises: Entities: false # Do names go beyond the 16 char limit for player disguises? -ExtendedNames: true +ExtendedNames: false # Do names resolve into scoreboard teams so changing the player name is flawless? # This will only work properly for names 28 chars or less in length. # Notch [DragonSlayer lvl: 28] diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 6d392282..609bce57 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -106,7 +106,6 @@ permissions: description: Allows player to get meta info libsdisguises.json: description: Allows player to parse held item to json - default: true libsdisguises.scoreboardtest: description: Test if the scoreboard is valid, this is a simple test. libsdisguises.config: