Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7550

launchProjectile(Arrow.class) not instance of Arrow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • 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 :

            Doc Doc
            Ssomar Ssomar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: