WickedProduction
10/13/2019 - 11:31 PM

Armor Stands

Episode 14:

package me.illuminatiproductions.youtubeplugin.commands;

import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;

public class ArmorStandCommand implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player){
            Player player = (Player) sender;
            //Creating the armor stand
            ArmorStand stand = (ArmorStand) player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND);
            //Methods you can do to the armor stand
            stand.setHelmet(new ItemStack(Material.BEACON));
            stand.setGlowing(true);
            stand.setBasePlate(false);
            stand.setBodyPose(new EulerAngle(Math.toRadians(0), Math.toRadians(45), Math.toRadians(0)));
            stand.setHeadPose(new EulerAngle(0, 45, 0));
            stand.setItemInHand(new ItemStack(Material.DIAMOND_AXE));
            stand.hasArms();

        }

        return true;
    }
}