24package com.dreamfirestudios.dreamcore.DreamArmorStand;
26import com.dreamfirestudios.dreamcore.DreamChat.DreamMessageFormatter;
27import com.dreamfirestudios.dreamcore.DreamChat.DreamMessageSettings;
28import net.kyori.adventure.text.Component;
29import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
30import org.bukkit.Location;
31import org.bukkit.entity.ArmorStand;
32import org.bukkit.entity.EntityType;
33import org.bukkit.Bukkit;
45 private final Location location;
46 private boolean isVisible =
true;
47 private boolean customNameVisible =
false;
48 private String customName =
"";
49 private boolean canPickupItems =
false;
50 private boolean gravity =
true;
51 private boolean arms =
false;
52 private boolean basePlate =
true;
53 private boolean small =
false;
54 private boolean marker =
false;
55 private boolean glowing =
false;
63 if (location ==
null || location.getWorld() ==
null) {
64 throw new IllegalArgumentException(
"Location or World cannot be null");
66 this.location = location;
73 this.isVisible = isVisible;
81 this.customNameVisible = customNameVisible;
89 this.customName = PlainTextComponentSerializer.plainText().serialize(
90 DreamMessageFormatter.format(customName, DreamMessageSettings.all())
99 this.canPickupItems = canPickupItems;
107 this.gravity = gravity;
123 this.basePlate = basePlate;
139 this.marker = marker;
147 this.glowing = glowing;
159 ArmorStand armorStand = (ArmorStand) location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND);
160 armorStand.setVisible(isVisible);
161 armorStand.setCustomNameVisible(customNameVisible);
162 armorStand.customName(Component.text(customName));
163 armorStand.setCanPickupItems(canPickupItems);
164 armorStand.setGravity(gravity);
165 armorStand.setArms(arms);
166 armorStand.setBasePlate(basePlate);
167 armorStand.setSmall(small);
168 armorStand.setMarker(marker);
169 armorStand.setGlowing(glowing);
172 armorStand, location, isVisible, customNameVisible, customName, canPickupItems, gravity
174 Bukkit.getPluginManager().callEvent(event);
Event fired when an ArmorStand is spawned.
A builder class for creating and configuring ArmorStand instances.
DreamfireArmorStandBuilder customNameVisible(boolean customNameVisible)
Sets whether the armor stand's custom name is visible.
DreamfireArmorStandBuilder canPickupItems(boolean canPickupItems)
Sets whether the armor stand can pick up items.
DreamfireArmorStandBuilder glowing(boolean glowing)
Sets whether the armor stand is glowing.
DreamfireArmorStandBuilder gravity(boolean gravity)
Sets whether gravity is applied to the armor stand.
DreamfireArmorStandBuilder arms(boolean arms)
Sets whether the armor stand has arms.
DreamfireArmorStandBuilder small(boolean small)
Sets whether the armor stand is small.
DreamfireArmorStandBuilder basePlate(boolean basePlate)
Sets whether the armor stand has a base plate.
DreamfireArmorStandBuilder visible(boolean isVisible)
Sets the visibility of the armor stand.
DreamfireArmorStandBuilder(Location location)
Creates a new DreamfireArmorStandBuilder at the given location.
DreamfireArmorStandBuilder marker(boolean marker)
Sets whether the armor stand is a marker (no hitbox).
DreamfireArmorStandBuilder customName(String customName)
Sets the custom name of the armor stand, applying DreamMessage formatting.
ArmorStand build()
Builds and spawns the configured ArmorStand at the location.