package io.github.aquerr.eaglefactions.common.util;

import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.event.cause.entity.damage.source.EntityDamageSource;

public class ModSupport
{
    /**
     * Checks if the given class comes from TechGuns
     * @param clazz class to check
     * @param <T> the type of class
     * @return <tt>true</tt> if class comes from TechGuns, <tt>false</tt> if not.
     */
    public static <T> boolean isTechGuns(final Class<T> clazz)
    {
        return clazz.getName().contains("techguns");
    }

    /**
     * Gets the attacking entity from the EntityDamageSource. EntityDamageSource must come from TechGuns.
     * @param entityDamageSource the source
     * @return attacking/source entity.
     */
    public static Entity getAttackerFromTechGuns(final EntityDamageSource entityDamageSource)
    {
        Object attacker = null;
        try
        {
            attacker = entityDamageSource.getClass().getField("attacker").get(entityDamageSource);
        }
        catch (IllegalAccessException | NoSuchFieldException e)
        {
            e.printStackTrace();
        }
        if (attacker instanceof Entity)
            return (Entity)attacker;
        else return null;
    }
}

@@ -550,16 +550,391 @@
 %0A    %7D%0A%0A
+    /**%0A     * Checks if the given class comes from AncientWarfare%0A     * @param clazz class to check%0A     * @param %3CT%3E the type of class%0A     * @return %3Ctt%3Etrue%3C/tt%3E if class comes from AncientWarfare, %3Ctt%3Efalse%3C/tt%3E if not.%0A     */%0A    public static %3CT%3E boolean isAncientWarfare(final Class%3CT%3E clazz)%0A    %7B%0A        return clazz.getName().contains(%22ancientwarfare%22);%0A    %7D%0A%0A
     /**%0A

Add method for checking if class comes from Ancient Warfare