From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: jmp <jasonpenilla2@me.com>
Date: Tue, 17 Nov 2020 13:12:09 -0800
Subject: [PATCH] Set name visible when using a Name Tag on an Armor Stand


diff --git a/src/main/java/net/minecraft/world/item/ItemNameTag.java b/src/main/java/net/minecraft/world/item/ItemNameTag.java
index b9b2b27e534ba87a1aae3c521f393a066a18a199..4f4e9ebb9af4970fe920a540d40dbc56682efd57 100644
--- a/src/main/java/net/minecraft/world/item/ItemNameTag.java
+++ b/src/main/java/net/minecraft/world/item/ItemNameTag.java
@@ -5,6 +5,7 @@ import net.minecraft.world.EnumHand;
 import net.minecraft.world.EnumInteractionResult;
 import net.minecraft.world.entity.EntityInsentient;
 import net.minecraft.world.entity.EntityLiving;
+import net.minecraft.world.entity.decoration.EntityArmorStand;
 import net.minecraft.world.entity.player.EntityHuman;
 
 // Paper start
@@ -27,6 +28,11 @@ public class ItemNameTag extends Item {
                 if (!event.callEvent()) return EnumInteractionResult.PASS;
                 EntityLiving newEntityLiving = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getEntity()).getHandle();
                 newEntityLiving.setCustomName(event.getName() != null ? PaperAdventure.asVanilla(event.getName()) : null);
+                // Purpur start
+                if (entityhuman.world.purpurConfig.armorstandFixNametags && entityliving instanceof EntityArmorStand) {
+                    entityliving.setCustomNameVisible(true);
+                }
+                // Purpur end
                 if (event.isPersistent() && newEntityLiving instanceof EntityInsentient) {
                     ((EntityInsentient) newEntityLiving).setPersistent();
                 }
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index d054678a1fc7825a4b43e5841ca9715a86d0d091..9298bfbf64aae5bcdd758e3cddba14f9e6e2ba4e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -84,9 +84,11 @@ public class PurpurWorldConfig {
     }
 
     public boolean armorstandSetNameVisible = false;
+    public boolean armorstandFixNametags = false;
     public float armorstandStepHeight = 0.0F;
     private void armorstandSettings() {
         armorstandSetNameVisible = getBoolean("gameplay-mechanics.armorstand.set-name-visible-when-placing-with-custom-name", armorstandSetNameVisible);
+        armorstandFixNametags = getBoolean("gameplay-mechanics.armorstand.fix-nametags", armorstandFixNametags);
         armorstandStepHeight = (float) getDouble("gameplay-mechanics.armorstand.step-height", armorstandStepHeight);
     }
 
