LazoYoung / CraftGames

Minecraft Paper plugin that enables you to make custom minigame scripts.
MIT License
2 stars 1 forks source link

Track how much damage an entity has taken. #81

Closed jupiter1390 closed 4 years ago

jupiter1390 commented 4 years ago

module to keep track on targeted entities' damage output(melee, projectile if possible) Could be used for custom score or game mechanic based on how much damage player has dealt, or other conditions

LazoYoung commented 4 years ago

I will implement GameEntityAttackEvent for you. Dispatching the event to your script should be easier and straightforward to achieve your idea. You keep the amount of total damage by defining a variable, and monitor the event to record it. That's pretty much it. If you need to know who/what dealt damage, investigate event.getAttacker(). It can be any Entity: an arrow, player, etc. You can check what item the attacker was holding to determine whether it was melee attack or not. Let's move to #82 and discuss further, shall we?