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

Bug with getting persistent data container

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • CraftBukkit version 3465-Spigot-ffceeae-3ec79a2 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT)
    • Yes

      When an entity (other than a player) throws a projectile and you try to get the items PDC in projectile launch event it does not return it.

      @EventHandler
      public void onShoot(ProjectileLaunchEvent e) {
          if (e.getEntityType() == EntityType.TRIDENT && e.getEntity().getShooter() instanceof LivingEntity && ((Trident) e.getEntity()).getItem().getItemMeta().getPersistentDataContainer().has(nameKey, PersistentDataType.BYTE))
          Bukkit.broadcastMessage("Thrown");
      }

      I have only tested this with tridents, but if a player throws it the server broadcasts the message, and if a drowned throws the same exact trident it does not.

            Unassigned Unassigned
            JewishBanana David White
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: