Advertisement
Guest User

Untitled

a guest
Feb 17th, 2021
194
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package floweroftruth.suka.oleg.ex.Suka.oleg;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.Material;
  6. import org.bukkit.World;
  7. import org.bukkit.block.Block;
  8. import org.bukkit.entity.ArmorStand;
  9. import org.bukkit.entity.Entity;
  10. import org.bukkit.entity.EntityType;
  11. import org.bukkit.entity.Player;
  12. import org.bukkit.event.EventHandler;
  13. import org.bukkit.event.Listener;
  14. import org.bukkit.event.player.PlayerInteractEvent;
  15. import org.bukkit.inventory.ItemStack;
  16. import org.bukkit.plugin.java.JavaPlugin;
  17. import org.bukkit.scheduler.BukkitRunnable;
  18. import org.bukkit.util.EulerAngle;
  19. import org.bukkit.util.Vector;
  20.  
  21. import java.util.*;
  22.  
  23. public final class ex extends JavaPlugin implements Listener {
  24.  
  25. @Override
  26. public void onEnable() {
  27. // Plugin startup logic
  28. Bukkit.getServer().getPluginManager().registerEvents(this, this);
  29.  
  30. }
  31.  
  32. @Override
  33. public void onDisable() {
  34. // Plugin shutdown logic
  35. }
  36.  
  37. @EventHandler
  38. public void Click(PlayerInteractEvent e) {
  39. Player player = e.getPlayer();
  40. if (player.getInventory().getItemInHand().getType().equals(Material.POPPY)) {
  41.  
  42. ArmorStand ar = (ArmorStand) player.getWorld().spawnEntity(player.getEyeLocation(), EntityType.ARMOR_STAND);
  43. ar.setVisible(false);
  44. ar.setGravity(false);
  45. ar.setArms(true);
  46. ItemStack poppy = new ItemStack(Material.POPPY);
  47. ar.setItemInHand(poppy);
  48.  
  49.  
  50.  
  51.  
  52.  
  53. Vector copy = player.getLocation().getDirection();
  54. ar.getLocation().setDirection(copy);
  55. new BukkitRunnable() {
  56. @Override
  57. public void run() {
  58.  
  59. if (ar.getLocation().getBlock().getType().equals(Material.AIR)) {
  60. ar.teleport(ar.getLocation().add(ar.getLocation().getDirection().multiply(1)));
  61. }else {
  62. World world = ar.getWorld();
  63. float power = 2.0f;
  64. world.createExplosion(ar.getLocation().getX(), ar.getLocation().getY(), ar.getLocation().getZ(), power, false, false);
  65. this.cancel();
  66. ar.remove();
  67. }
  68. }
  69. }.runTaskTimer(this, 10, 1);
  70.  
  71. }
  72. }
  73. }
  74.  
Advertisement
RAW Paste Data Copied
Advertisement