Advertisement
Guest User

My code

a guest
Nov 6th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. @EventHandler
  2. public void PolaratiteAbility2(PlayerInteractEvent e) {
  3.  
  4.  
  5. if (e.hasItem()) {
  6. Player p = e.getPlayer();
  7. if (Objects.requireNonNull(Objects.requireNonNull(e.getItem()).getItemMeta()).getDisplayName().equals(ChatColor.RED + "+- Polaratite -+")) {
  8. ItemStack dummyitem = new ItemStack(Material.AMETHYST_SHARD);
  9. ItemMeta dummyitemMeta = dummyitem.getItemMeta();
  10. assert dummyitemMeta != null;
  11. dummyitemMeta.setCustomModelData(1);
  12.  
  13.  
  14. ArmorStand projectile = p.getWorld().spawn(p.getLocation(), ArmorStand.class);
  15. projectile.setSmall(true);
  16. projectile.setVisible(false);
  17. projectile.setHelmet(dummyitem);
  18. projectile.setGravity(false);
  19. projectile.setRemoveWhenFarAway(true);
  20. projectile.setMarker(true);
  21. projectile.setRotation(p.getLocation().getYaw(), p.getLocation().getPitch());
  22.  
  23. Location loc = projectile.getLocation();
  24. Vector dir = loc.getDirection();
  25. dir = dir.mulitply(1);
  26. dir = dir.normalize();
  27. Location newLocation = loc.add(dir);
  28. projectile.teleport( newLocation );
  29. }
  30. }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement