Class EntityDamageByEntityListener

java.lang.Object
com.ranull.graves.listener.EntityDamageByEntityListener
All Implemented Interfaces:
org.bukkit.event.Listener

public class EntityDamageByEntityListener extends Object implements org.bukkit.event.Listener
Listens for EntityDamageByEntityEvent to manage damage to specific entities.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Graves
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new EntityDamageByEntityListener with the specified Graves plugin.
  • Method Summary

    Modifier and Type
    Method
    Description
    private boolean
    isAssociatedWithGrave(org.bukkit.entity.Entity entity)
    Checks if the entity is associated with a grave.
    private boolean
    Checks if the server version is 1.7 or above.
    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.
    private boolean
    shouldCancelDamage(org.bukkit.entity.Entity entity)
    Determines if damage to the entity should be cancelled.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • plugin

      private final Graves plugin
  • Constructor Details

    • EntityDamageByEntityListener

      public EntityDamageByEntityListener(Graves plugin)
      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.