Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EventHandler
- public void PolaratiteAbility2(PlayerInteractEvent e) {
- if (e.hasItem()) {
- Player p = e.getPlayer();
- if (Objects.requireNonNull(Objects.requireNonNull(e.getItem()).getItemMeta()).getDisplayName().equals(ChatColor.RED + "+- Polaratite -+")) {
- ItemStack dummyitem = new ItemStack(Material.AMETHYST_SHARD);
- ItemMeta dummyitemMeta = dummyitem.getItemMeta();
- assert dummyitemMeta != null;
- dummyitemMeta.setCustomModelData(1);
- ArmorStand projectile = p.getWorld().spawn(p.getLocation(), ArmorStand.class);
- projectile.setSmall(true);
- projectile.setVisible(false);
- projectile.setHelmet(dummyitem);
- projectile.setGravity(false);
- projectile.setRemoveWhenFarAway(true);
- projectile.setMarker(true);
- projectile.setRotation(p.getLocation().getYaw(), p.getLocation().getPitch());
- Location loc = projectile.getLocation();
- Vector dir = loc.getDirection();
- dir = dir.mulitply(1);
- dir = dir.normalize();
- Location newLocation = loc.add(dir);
- projectile.teleport( newLocation );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement