Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weapon hits do not seem to trigger PlayerItemDamageEvent #414

Open
Indyuce opened this issue Apr 26, 2024 · 0 comments
Open

Weapon hits do not seem to trigger PlayerItemDamageEvent #414

Indyuce opened this issue Apr 26, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Indyuce
Copy link

Indyuce commented Apr 26, 2024

Current/Expected Behavior

Weapon hits do lower the vanilla durability bar of items but do not apply the PlayerItemDamageEvent Bukkit event. When player A shoots player B, if player B is wearing an armor item, the durability of the armor item goes down, but no event is called.

I am working on a plugin which implements custom durability for every item. The fact that ItemDamage events are not being called makes it hard for me to update the remaining item custom durability when a player is SHOT by any weapon.

This make senses to align weapon hit durability logic onto corresponding vanilla behaviour with, say, when a player is hit by an arrow. Players shot by an arrow do trigger this event.

Steps To Reproduce

  1. Write a simple plugin that listens to PlayerItemDamageEvents and prints out the content of this event in the console.
  2. Player B is wearing an iron chestplate not marked with the Unbreakable NBT tag.
  3. Player A shoots player B with any weapon, I tried using an AK-47
  4. No console output. Player B does lose vanilla durability points on their item but no ItemDamage event is called.

Log File

When A hits B with an arrow (event gets called)

[19:11:33 INFO]: Indyuce issued server command: /i arrow
[19:11:35 INFO]: Indyuce issued server command: /i bow 1
[19:11:36 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:11:37 INFO]: item damage event Indyuce 1 BOW // player A consuming durability of bow used
[19:11:37 INFO]: Event damage entity PROJECTILE PLAYER damager ARROW
[19:11:37 INFO]: item damage event Indusich 2 IRON_CHESTPLATE // <====== item damage event!!!

When A repeatedly hits B with weapon (no event is called)

[19:12:43 INFO]: Indyuce issued server command: /ml statmod Indusich MAX_HEALTH 100000
[19:12:45 INFO]: Indyuce issued server command: /heal Indusich
[19:12:46 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:12:46 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:46 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:46 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:12:46 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:46 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:46 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:12:46 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:46 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:46 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:12:46 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:46 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:46 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:12:47 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:47 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:47 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:12:47 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:47 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:47 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:12:47 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:47 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:47 INFO]: interact event Indyuce RIGHT_CLICK_AIR
[19:12:47 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER
[19:12:47 INFO]: Event damage entity ENTITY_ATTACK PLAYER damager PLAYER

latest.log

Anything else?

No response

@Indyuce Indyuce added the bug Something isn't working label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant