[SPIGOT-7550] launchProjectile(Arrow.class) not instance of Arrow Created: 19/Dec/23  Updated: 25/Dec/24  Resolved: 20/Dec/23

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Ssomar Assignee: Doc
Resolution: Fixed Votes: 0
Labels: None

Attachments: File Test.jar     PNG File image-2023-12-19-22-47-51-323.png     PNG File image-2023-12-19-22-50-37-270.png     PNG File image-2023-12-20-18-10-18-356.png    
Version: This server is running CraftBukkit version 3976-Spigot-06d602e-b3b43a6 (MC: 1.20.4)
Guidelines Read: Yes

 Description   

Hello, 

If you launch an arrow with the method launchProjectile(), the entity return by this method is not instance of Arrow.

 

Example with a simple event

@EventHandler()
public void onPlayerToggleSneakEvent(PlayerToggleSneakEvent e) {
    Bukkit.broadcastMessage("PlayerToggleSneakEvent");
    if (e.isSneaking()) {
        Entity entity = e.getPlayer().launchProjectile(Arrow.class);
        Bukkit.broadcastMessage("Projectile instance of Arrow ? "+(entity instanceof Arrow));
    } else Bukkit.broadcastMessage("Not Sneaking");
} 

Output of this event :



 Comments   
Comment by Ssomar [ 20/Dec/23 ]

Thank you very much

Comment by Doc [ 20/Dec/23 ]

I check internally and i create a PR for fix this. https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/1319/overview

Comment by Ssomar [ 20/Dec/23 ]

I don't understand your comment Doc, you mean that 
(entity instanceof Arrow)
return true ?

Can you share the ouputs sent by Test.jar plugin ?

Comment by Doc [ 20/Dec/23 ]

Currently tested the Class result of that is AbstractArrow and not Arrow, tested in plugin and that return true..

Comment by Ssomar [ 20/Dec/23 ]

Comment by Black Hole [ 20/Dec/23 ]

Could you add entity.toString() to the output?

Generated at Sat Dec 13 15:25:31 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.