Solved Change Arrow Damage

Discussion in 'Spigot Plugin Development' started by jd007, Jul 12, 2021.

Thread Status:
Not open for further replies.
  1. Hello,
    I am developing a custom Bow plugin, where you have a bow called "Ultimate Bow" when you left-click the bow, an arrow appears in front of the player with a certain speed and then hits the Entity you want to shoot. I noticed that the arrow spawning does almost no damage, so I need to increase it. What should I do?
    Remember this arrow appears in front of the player, so the player is NOT considered the shooter.

    Thank you!
     
  2. Try adding a special tag to the arrow using its persistent data container!
    Then, listen to the EntityDamageEvent, and check if the entity that damaged the entity is the arrow by checking if it has the tag in its persistent data container. If it has the tag, increase the damage of the event. :)
     
  3. If you're doing this on 1.12.2 then you'll have to do it the long way:
    Use NBT to add a tag to the arrow, then listen to EntityDamageByEntityEvent and check if the damager is an arrow and if it is then check if it has that NBT tag - if yes, then change the damage.
     
    • Agree Agree x 1
  4. Not at all necessary. You can just use the API, namely MetaData (which I know for a fact existed at least as far back as 1.7.10). Sure it won’t be persistent across restarts, but for an arrow which is shot directly that doesn’t matter. And it has the huge bonus of not relying on unnecessary NMS;).
     
  5. Shoot, 1.12.2... Sorry XD
    I prefer my version.
     
Thread Status:
Not open for further replies.