diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java index 575446fb7a8..033e3ca489f 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/utils/ArmorStandUtils.java @@ -2,6 +2,8 @@ import javax.annotation.Nonnull; +import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion; +import io.github.thebusybiscuit.slimefun4.implementation.Slimefun; import org.bukkit.Location; import org.bukkit.entity.ArmorStand; @@ -47,13 +49,22 @@ public class ArmorStandUtils { * @return The spawned {@link ArmorStand} */ public static @Nonnull ArmorStand spawnArmorStand(@Nonnull Location location) { - return location.getWorld().spawn(location, ArmorStand.class, armorStand -> { - armorStand.setVisible(false); - armorStand.setSilent(true); - armorStand.setMarker(true); - armorStand.setGravity(false); - armorStand.setBasePlate(false); - armorStand.setRemoveWhenFarAway(false); - }); + // 1.19 and below don't have the consumer method so flicker exists on these versions. + if (Slimefun.getMinecraftVersion().isBefore(MinecraftVersion.MINECRAFT_1_20)) { + ArmorStand armorStand = location.getWorld().spawn(location, ArmorStand.class); + setupArmorStand(armorStand); + return armorStand; + } + + return location.getWorld().spawn(location, ArmorStand.class, armorStand -> setupArmorStand(armorStand)); + } + + private static void setupArmorStand(ArmorStand armorStand) { + armorStand.setVisible(false); + armorStand.setSilent(true); + armorStand.setMarker(true); + armorStand.setGravity(false); + armorStand.setBasePlate(false); + armorStand.setRemoveWhenFarAway(false); } }