launchProjectile(Arrow.class) not instance of Arrow

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor
    • None
    • Affects Version/s: None
    • None
    • This server is running CraftBukkit version 3976-Spigot-06d602e-b3b43a6 (MC: 1.20.4)
    • Yes

      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 :

        1. image-2023-12-19-22-47-51-323.png
          6 kB
          Ssomar
        2. image-2023-12-19-22-50-37-270.png
          7 kB
          Ssomar
        3. image-2023-12-20-18-10-18-356.png
          8 kB
          Ssomar

            Assignee:
            Doc
            Reporter:
            Ssomar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: