Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.lexepi.armorstand.ArmorStandTnT;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Player;
- import org.bukkit.entity.TNTPrimed;
- import org.bukkit.craftbukkit.v1_8_R1.entity.CraftArmorStand;
- import org.bukkit.entity.ArmorStand;
- import net.minecraft.server.v1_8_R1.EntityArmorStand;
- import net.minecraft.server.v1_8_R1.Item;
- import net.minecraft.server.v1_8_R1.ItemStack;
- import net.minecraft.server.v1_8_R1.Vector3f;
- public class MyStandTnT implements CommandExecutor{
- int countdown = 11;
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if(label.equalsIgnoreCase("as")){
- if(sender instanceof Player){
- Player player = (Player)sender;
- Location l = player.getLocation();
- ArmorStand stand = ((ArmorStand) l.getWorld().spawnEntity(l, EntityType.ARMOR_STAND));
- EntityArmorStand as = ((CraftArmorStand) stand).getHandle();
- as.setGravity(true);
- as.setBasePlate(true);
- as.setArms(true);
- as.setEquipment(1, new ItemStack(Item.getById(298)));
- as.setEquipment(2, new ItemStack(Item.getById(299)));
- as.setEquipment(3, new ItemStack(Item.getById(300)));
- as.setEquipment(4, new ItemStack(Item.getById(46)));
- as.setLeftArmPose(new Vector3f(5f, 0f, -150f));
- as.setRightArmPose(new Vector3f(5f, 0f, 150f));
- as.setHeadPose(new Vector3f(-30f, 0f, 0f));
- Bukkit.getScheduler().scheduleSyncRepeatingTask(Bukkit.getPluginManager().getPlugin("ArmorStand"), new Runnable() {
- @Override
- public void run() {
- countdown--;
- double x = stand.getLocation().getX();
- double y = stand.getLocation().getY();
- double z = stand.getLocation().getZ();
- TNTPrimed tnt = (TNTPrimed) stand.getWorld().spawn(new Location(stand.getWorld(), x, y+2, z), TNTPrimed.class);
- if(countdown == 10){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(0));
- }else if(countdown == 9){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1));
- }else if(countdown == 8){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1.2));
- }else if(countdown == 7){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1.3));
- }else if(countdown == 6){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1.4));
- }else if(countdown == 5){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1.5));
- }else if(countdown == 4){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1.6));
- }else if(countdown == 3){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1.7));
- }else if(countdown == 2){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1.8));
- }else if(countdown == 1){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(1.9));
- }else if(countdown == 0){
- tnt.setVelocity(stand.getLocation().getDirection().normalize().multiply(2));
- stand.remove();
- Bukkit.getScheduler().cancelTask(countdown);
- }
- }
- },5, 5);
- }
- return true;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment