Class ListenerUtil

java.lang.Object
studio.magemonkey.fabled.listener.ListenerUtil

public class ListenerUtil extends Object
Helper class for listeners
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.bukkit.inventory.Inventory
    getClickedInventory(org.bukkit.event.inventory.InventoryClickEvent event)
     
    static org.bukkit.entity.LivingEntity
    getDamager(org.bukkit.event.entity.EntityDamageByEntityEvent event)
    Retrieves a damager from an entity damage event which will get the shooter of projectiles if it was a projectile hitting them or converts the Entity damager to a LivingEntity if applicable.
    static String
    getName(org.bukkit.entity.Entity entity)
    Gets a simple name of the entity

    Methods inherited from class java.lang.Object

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

    • ListenerUtil

      public ListenerUtil()
  • Method Details

    • getDamager

      public static org.bukkit.entity.LivingEntity getDamager(org.bukkit.event.entity.EntityDamageByEntityEvent event)
      Retrieves a damager from an entity damage event which will get the shooter of projectiles if it was a projectile hitting them or converts the Entity damager to a LivingEntity if applicable.
      Parameters:
      event - event to grab the damager from
      Returns:
      LivingEntity damager of the event or null if not found
    • getClickedInventory

      public static org.bukkit.inventory.Inventory getClickedInventory(org.bukkit.event.inventory.InventoryClickEvent event)
    • getName

      public static String getName(org.bukkit.entity.Entity entity)
      Gets a simple name of the entity
      Parameters:
      entity - entity to get the name of
      Returns:
      simple name of the entity