Package com.ranull.graves.listener
Class EntityDamageByEntityListener
java.lang.Object
com.ranull.graves.listener.EntityDamageByEntityListener
- All Implemented Interfaces:
org.bukkit.event.Listener
Listens for EntityDamageByEntityEvent to manage damage to specific entities.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionEntityDamageByEntityListener(Graves plugin) Constructs a new EntityDamageByEntityListener with the specified Graves plugin. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanisAssociatedWithGrave(org.bukkit.entity.Entity entity) Checks if the entity is associated with a grave.private booleanChecks if the server version is 1.7 or above.voidonEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles EntityDamageByEntityEvent to determine if damage should be cancelled based on the entity type and associated data.private booleanshouldCancelDamage(org.bukkit.entity.Entity entity) Determines if damage to the entity should be cancelled.
-
Field Details
-
plugin
-
-
Constructor Details
-
EntityDamageByEntityListener
Constructs a new EntityDamageByEntityListener with the specified Graves plugin.- Parameters:
plugin- The Graves plugin instance.
-
-
Method Details
-
onEntityDamageByEntity
public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event) Handles EntityDamageByEntityEvent to determine if damage should be cancelled based on the entity type and associated data.- Parameters:
event- The EntityDamageByEntityEvent to handle.
-
shouldCancelDamage
private boolean shouldCancelDamage(org.bukkit.entity.Entity entity) Determines if damage to the entity should be cancelled.- Parameters:
entity- The entity being damaged.- Returns:
- True if the damage should be cancelled, false otherwise.
-
isVersion1_7OrAbove
private boolean isVersion1_7OrAbove()Checks if the server version is 1.7 or above.- Returns:
- True if the server version is 1.7 or above, false otherwise.
-
isAssociatedWithGrave
private boolean isAssociatedWithGrave(org.bukkit.entity.Entity entity) Checks if the entity is associated with a grave.- Parameters:
entity- The entity to check.- Returns:
- True if the entity is associated with a grave, false otherwise.
-