24package com.dreamfirestudios.dreamcore.DreamArmorStand;
26import com.dreamfirestudios.dreamcore.DreamChat.DreamMessageFormatter;
27import com.dreamfirestudios.dreamcore.DreamChat.DreamMessageSettings;
28import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
29import org.bukkit.Location;
30import org.bukkit.entity.ArmorStand;
31import org.bukkit.inventory.ItemStack;
33import java.util.Objects;
52 if (armorStand ==
null || item ==
null)
throw new IllegalArgumentException(
"ArmorStand or Item cannot be null");
55 case HEAD -> armorStand.getEquipment().setHelmet(item);
56 case CHEST -> armorStand.getEquipment().setChestplate(item);
57 case LEGS -> armorStand.getEquipment().setLeggings(item);
58 case FEET -> armorStand.getEquipment().setBoots(item);
59 case HAND -> armorStand.getEquipment().setItemInMainHand(item);
60 case OFFHAND -> armorStand.getEquipment().setItemInOffHand(item);
61 default ->
throw new IllegalArgumentException(
"Unknown ArmorStand slot: " + slot);
78 public static void setPose(ArmorStand armorStand,
ArmorStandPose pose,
float angleX,
float angleY,
float angleZ) {
79 if (armorStand ==
null || pose ==
null)
throw new IllegalArgumentException(
"ArmorStand or Pose cannot be null");
81 var rotation =
new org.bukkit.util.EulerAngle(Math.toRadians(angleX), Math.toRadians(angleY), Math.toRadians(angleZ));
84 case HEAD -> armorStand.setHeadPose(rotation);
85 case BODY -> armorStand.setBodyPose(rotation);
86 case LEFT_ARM -> armorStand.setLeftArmPose(rotation);
87 case RIGHT_ARM -> armorStand.setRightArmPose(rotation);
88 case LEFT_LEG -> armorStand.setLeftLegPose(rotation);
89 case RIGHT_LEG -> armorStand.setRightLegPose(rotation);
103 if (armorStand ==
null)
throw new IllegalArgumentException(
"ArmorStand cannot be null");
104 armorStand.setVisible(!armorStand.isVisible());
115 if (armorStand ==
null)
throw new IllegalArgumentException(
"ArmorStand cannot be null");
116 armorStand.setGravity(
false);
127 if (armorStand ==
null)
throw new IllegalArgumentException(
"ArmorStand cannot be null");
128 armorStand.setGravity(
true);
139 public static void setGlowing(ArmorStand armorStand,
boolean glowing) {
140 if (armorStand ==
null)
throw new IllegalArgumentException(
"ArmorStand cannot be null");
141 armorStand.setGlowing(glowing);
154 if (armorStand ==
null || newLocation ==
null)
throw new IllegalArgumentException(
"ArmorStand or Location cannot be null");
155 armorStand.teleport(newLocation);
166 public static void setCustomName(ArmorStand armorStand, String customName) {
167 if (armorStand ==
null || customName ==
null)
throw new IllegalArgumentException(
"ArmorStand or CustomName cannot be null");
168 armorStand.customName(DreamMessageFormatter.format(customName, DreamMessageSettings.all()));
180 if (original ==
null)
throw new IllegalArgumentException(
"Original ArmorStand cannot be null");
181 Location loc = original.getLocation();
184 .customNameVisible(original.isCustomNameVisible())
185 .customName(PlainTextComponentSerializer.plainText().serialize(Objects.requireNonNull(original.customName())))
186 .canPickupItems(original.getCanPickupItems())
187 .gravity(original.hasGravity())
188 .arms(original.hasArms())
189 .basePlate(original.hasBasePlate())
190 .small(original.isSmall())
191 .marker(original.isMarker())
192 .glowing(original.isGlowing())
Event fired when an ArmorStand is equipped with an item in a specific slot.
Event fired when an ArmorStand has its glowing state changed.
Event fired when an ArmorStand has one of its poses changed.
Utility class for performing operations on ArmorStand entities, such as equipping items,...
static void toggleVisibility(ArmorStand armorStand)
Toggles the visibility of the armor stand.
static void disableGravity(ArmorStand armorStand)
Disables gravity for the armor stand.
static void setGlowing(ArmorStand armorStand, boolean glowing)
Sets the glowing effect for the armor stand.
static void setPose(ArmorStand armorStand, ArmorStandPose pose, float angleX, float angleY, float angleZ)
Sets the pose of the armor stand.
static void equipArmorStand(ArmorStand armorStand, ItemStack item, ArmorStandSlot slot)
Equips an armor stand with an item in a specific slot.
static void setCustomName(ArmorStand armorStand, String customName)
Sets a custom name for the armor stand.
static void teleportArmorStand(ArmorStand armorStand, Location newLocation)
Teleports the armor stand to a new location.
static ArmorStand cloneArmorStand(ArmorStand original)
Clones an armor stand by creating a new instance with the same properties.
static void enableGravity(ArmorStand armorStand)
Enables gravity for the armor stand.
A builder class for creating and configuring ArmorStand instances.
DreamfireArmorStandBuilder visible(boolean isVisible)
Sets the visibility of the armor stand.
Represents the different body parts of an org.bukkit.entity.ArmorStand that can be posed or animated.
Represents the equipment slots of an org.bukkit.entity.ArmorStand.