Set CustomName to arrow

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

italo

New Member
Aug 8, 2023
8
0
1
16
I want to create custom arrows, part of which I have already done in IntelliJ, and it works, but the arrows are issued through Skript. How can I set a custom name for the arrow so that I can check it in IntelliJ?

CSS:
command /test:
  trigger:
    if arg-1 is set:
      set {_item} to arrow
      give {_item} to arg-1


Java:
@EventHandler
public void onProjectileHitEvent(ProjectileHitEvent e) {
    Projectile proj = e.getEntity();
    if (proj instanceof Arrow) {
        Arrow arrow = (Arrow) proj;
        if (arrow.getCustomName().toLowerCase().equals("freeze")) {
            LivingEntity shooter = (LivingEntity) arrow.getShooter();
            shooter.teleport(arrow.getLocation());
            arrow.remove();
        }
    }
}
 
idk if this shall do what you like but here
Code:
command /test <text> [<player>]:
    usage: The correct usage is /test <arrow name> [<player>]
    trigger:
        if arg-2 is set:
            set {_customname} to arg-1
            set {_item} to arrow
            give {_item} named "%{_customname}%" to arg-2
        else:
            set {_customname} to arg-1
            set {_item} to arrow
            give {_item} named "%{_customname}%" to player