package com.extrahardmode.compatibility;


import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import uk.co.oliwali.HawkEye.DataType;
import uk.co.oliwali.HawkEye.entry.BlockChangeEntry;
import uk.co.oliwali.HawkEye.entry.BlockEntry;
import uk.co.oliwali.HawkEye.util.BlockUtil;
import uk.co.oliwali.HawkEye.util.HawkEyeAPI;

/**
 * Thanks HawkEye for wasting my time
 */
public class CompatHawkEye implements ICompat, IBlockLogger
{
    private final JavaPlugin plugin;
    private boolean hawkEyeEnabled = true;


    public CompatHawkEye(Plugin plugin)
    {
        this.plugin = (JavaPlugin) plugin;
        try
        {
            Class.forName("uk.co.oliwali.HawkEye.util.HawkEyeAPI");
        } catch (ClassNotFoundException ignored)
        {
            hawkEyeEnabled = false;
        }
    }


    @Override
    public void logFallingBlockFall(Block block)
    {
        HawkEyeAPI.addEntry(plugin, new BlockEntry(fallingBlockFallTag, DataType.BLOCK_BREAK, block));
    }


    @Override
    public void logFallingBlockLand(BlockState block)
    {
        String after = BlockUtil.getBlockString(block.getBlock());
        String before = block.getRawData() != 0 ? block.getTypeId() + ":" + block.getRawData() : Integer.toString(block.getTypeId());
        HawkEyeAPI.addEntry(plugin, new BlockChangeEntry(fallingBlockLandTag, DataType.BLOCK_PLACE, block.getLocation(), before, after));
    }


    @Override
    public boolean isEnabled()
    {
        return hawkEyeEnabled;
    }
}

@@ -217,16 +217,54 @@
 taType;%0A
+import uk.co.oliwali.HawkEye.HawkEye;%0A
 import u
@@ -630,17 +630,10 @@
 bled
- = true
 ;%0A
+
 %0A%0A  
@@ -731,86 +731,84 @@
     
-try%0A        %7B%0A            Class.forName(%22uk.co.oliwali.HawkEye.util.
+Plugin hawkPlugin = plugin.getServer().getPluginManager().getPlugin(%22
 HawkEye
-API
 %22);%0A
@@ -819,104 +819,55 @@
     
-%7D catch (ClassNotFoundException ignored)%0A        %7B%0A            hawkEyeEnabled = false;%0A        %7D
+hawkEyeEnabled = hawkPlugin instanceof HawkEye;
 %0A   

Fix HawkEye not being recognized correctly