package com.elmakers.mine.bukkit.entity;

import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;

public class EntityArmorStandData extends EntityExtraData {
    public ItemStack itemInHand;
    public ItemStack boots;
    public ItemStack leggings;
    public ItemStack chestplate;
    public ItemStack helmet;
    public EulerAngle bodyPose;
    public EulerAngle leftArmPose;
    public EulerAngle rightArmPose;
    public EulerAngle leftLegPose;
    public EulerAngle rightLegPose;
    public EulerAngle headPose;
    public boolean hasGravity;
    public boolean isVisible;
    public boolean hasArms;
    public boolean isSmall;
    public boolean hasBasePlate;

    public EntityArmorStandData() {

    }

    public EntityArmorStandData(ArmorStand armorStand) {
        itemInHand = armorStand.getItemInHand();
        if (itemInHand != null) itemInHand = itemInHand.clone();
        boots = armorStand.getBoots();
        if (boots != null) boots = boots.clone();
        leggings = armorStand.getLeggings();
        if (leggings != null) leggings = leggings.clone();
        chestplate = armorStand.getChestplate();
        if (chestplate != null) chestplate = chestplate.clone();
        helmet = armorStand.getHelmet();
        if (helmet != null) helmet = helmet.clone();
        bodyPose = armorStand.getBodyPose();
        leftArmPose = armorStand.getLeftArmPose();
        rightArmPose = armorStand.getRightArmPose();
        leftLegPose = armorStand.getLeftLegPose();
        rightLegPose = armorStand.getRightLegPose();
        headPose = armorStand.getHeadPose();
        hasGravity = armorStand.hasGravity();
        isVisible = armorStand.isVisible();
        hasArms = armorStand.hasArms();
        isSmall = armorStand.isSmall();
        hasBasePlate = armorStand.hasBasePlate();
    }

    @Override
    public void apply(Entity entity) {
        if (!(entity instanceof ArmorStand)) return;
        ArmorStand armorStand = (ArmorStand)entity;

        armorStand.setItemInHand(itemInHand);
        armorStand.setBoots(boots);
        armorStand.setLeggings(leggings);
        armorStand.setChestplate(chestplate);
        armorStand.setHelmet(helmet);
        armorStand.setBodyPose(bodyPose);
        armorStand.setLeftArmPose(leftArmPose);
        armorStand.setRightArmPose(rightArmPose);
        armorStand.setLeftLegPose(leftLegPose);
        armorStand.setRightLegPose(rightLegPose);
        armorStand.setHeadPose(headPose);
        armorStand.setGravity(hasGravity);
        armorStand.setVisible(isVisible);
        armorStand.setArms(hasArms);
        armorStand.setSmall(isSmall);
        armorStand.setBasePlate(hasBasePlate);
    }

    @Override
    public EntityExtraData clone() {
        EntityArmorStandData copy = new EntityArmorStandData();
        copy.itemInHand = itemInHand == null ? null : itemInHand.clone();
        copy.boots = boots == null ? null : boots.clone();
        copy.leggings = leggings == null ? null : leggings.clone();
        copy.chestplate = chestplate == null ? null : chestplate.clone();
        copy.helmet = helmet == null ? null : helmet.clone();
        copy.bodyPose = bodyPose == null ? null : new EulerAngle(bodyPose.getX(), bodyPose.getY(), bodyPose.getZ());
        copy.leftArmPose = leftArmPose == null ? null : new EulerAngle(leftArmPose.getX(), leftArmPose.getY(), leftArmPose.getZ());
        copy.rightArmPose = rightArmPose == null ? null : new EulerAngle(rightArmPose.getX(), rightArmPose.getY(), rightArmPose.getZ());
        copy.leftLegPose = leftLegPose == null ? null : new EulerAngle(leftLegPose.getX(), leftLegPose.getY(), leftLegPose.getZ());
        copy.rightLegPose = rightLegPose == null ? null : new EulerAngle(rightLegPose.getX(), rightLegPose.getY(), rightLegPose.getZ());
        copy.headPose = headPose == null ? null : new EulerAngle(headPose.getX(), headPose.getY(), headPose.getZ());
        copy.hasGravity = hasGravity;
        copy.isVisible = isVisible;
        copy.hasArms = hasArms;
        copy.isSmall = isSmall;
        copy.hasBasePlate = hasBasePlate;
        return copy;
    }

    @Override
    public void removed(Entity entity) {
        if (!(entity instanceof ArmorStand)) return;
        ArmorStand armorStand = (ArmorStand)entity;
        armorStand.setItemInHand(null);
        armorStand.setHelmet(null);
        armorStand.setChestplate(null);
        armorStand.setLeggings(null);
        armorStand.setBoots(null);
    }
}

@@ -35,16 +35,70 @@
 ntity;%0A%0A
+import org.bukkit.configuration.ConfigurationSection;%0A
 import o
@@ -650,24 +650,53 @@
 e headPose;%0A
+    public boolean isMarker;%0A
     public b
@@ -1964,24 +1964,447 @@
 asePlate();%0A
+        isMarker = armorStand.isMarker();%0A    %7D%0A%0A    public EntityArmorStandData(ConfigurationSection parameters) %7B%0A        isSmall = parameters.getBoolean(%22small%22, false);%0A        isVisible = !parameters.getBoolean(%22invisible%22, false);%0A        hasBasePlate = !parameters.getBoolean(%22baseplate%22, true);%0A        hasGravity = parameters.getBoolean(%22gravity%22, true);%0A        isMarker = parameters.getBoolean(%22marker%22, false);%0A
     %7D%0A%0A    @
@@ -2764,32 +2764,54 @@
 helmet);%0A       
+ if (bodyPose != null)
  armorStand.setB
@@ -2828,32 +2828,57 @@
 dyPose);%0A       
+ if (leftArmPose != null)
  armorStand.setL
@@ -2901,32 +2901,58 @@
 rmPose);%0A       
+ if (rightArmPose != null)
  armorStand.setR
@@ -2977,32 +2977,57 @@
 rmPose);%0A       
+ if (leftLegPose != null)
  armorStand.setL
@@ -3050,32 +3050,58 @@
 egPose);%0A       
+ if (rightLegPose != null)
  armorStand.setR
@@ -3126,32 +3126,54 @@
 egPose);%0A       
+ if (headPose != null)
  armorStand.setH
@@ -3394,24 +3394,64 @@
 BasePlate);%0A
+        armorStand.setMarker(isMarker);%0A
     %7D%0A%0A    @
@@ -4845,24 +4845,58 @@
 sBasePlate;%0A
+        copy.isMarker = isMarker;%0A
         retu

Add support for loading armor stands from configs, including various flags like small, marker, gravity