Inventory Click Event help Needed

Error is the Event don´t get canceled even when the “if” is triggered.

There are no Errors inside the Console.

package me.cursedbreath.events;

import me.cursedbreath.other.Inventorys;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

public class ClickEvent implements Listener {


    @EventHandler(priority = EventPriority.HIGH)
    public void onClickEvent(InventoryClickEvent e)
    {
        //Navigator ItemStack
        ItemStack Navigator = new ItemStack(Material.COMPASS, 1);
        ItemMeta NavigatorM = Navigator.getItemMeta();
        NavigatorM.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&2Navigator"));
        Navigator.setItemMeta(NavigatorM);

            Player p = (Player) e.getWhoClicked();
            if(e.getClickedInventory() == p.getInventory())
            {
                if(e.getCurrentItem() != null)
                {
                    if(e.getCurrentItem().isSimilar(Navigator))
                    {
                        Bukkit.broadcastMessage("Navigator Test Message"); // <-- get send look picture below.
                        e.setCancelled(true); // <-- Don´t work
                        e.setResult(Event.Result.DENY);
                    }
                    else if (e.getSlot() == 8) {
                        if (!e.isCancelled()) {
                            Bukkit.broadcastMessage("Slot Test Message"); // <-- get send look picture below.
                            e.setCancelled(true); // <-- Don´t work
                        }

                    }
                    else
                    {
                        e.setCancelled(false);
                    }
                }
            }
            if(e.getClickedInventory() == Inventorys.Navigator)
            {
                e.setCancelled(true);
            }
            else
            {
                e.setCancelled(false);
            }


    }

    @EventHandler
    public void onRightClick(PlayerInteractEvent e)
    {
        Player p = e.getPlayer();
        if(!(e.getAction() == Action.RIGHT_CLICK_AIR)) return;
        if((e.getItem().getType() == Material.COMPASS) && (e.getItem().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.translateAlternateColorCodes('&', "&2Navigator"))))
        {
            p.openInventory(Inventorys.Navigator);
        }
    }
}

MCMessage

Have found a little Workaround for the Issue, but would like to find some more Solution to this Error.

New Code is Here:

package me.cursedbreath.events;

import me.cursedbreath.other.Inventorys;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

public class ClickEvent implements Listener {


    @EventHandler
    public void onClickEvent(InventoryClickEvent e)
    {
        //Navigator ItemStack
        ItemStack Navigator = new ItemStack(Material.COMPASS, 1);
        ItemMeta NavigatorM = Navigator.getItemMeta();
        NavigatorM.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&2Navigator"));
        Navigator.setItemMeta(NavigatorM);

            Player p = (Player) e.getWhoClicked();
            if(e.getClickedInventory() == p.getInventory())
            {
                if(e.getCurrentItem() != null)
                {
                    if (e.getCurrentItem().isSimilar(Navigator)) {
                        p.openInventory(Inventorys.Navigator);
                        p.updateInventory();
                    }
                    else
                    {
                        e.setCancelled(false);
                    }
                }
            }
            if(e.getClickedInventory() == Inventorys.Navigator)
            {
                e.setCancelled(true);
            }
            else
            {
                e.setCancelled(false);
            }


    }

    @EventHandler
    public void onRightClick(PlayerInteractEvent e)
    {
        Player p = e.getPlayer();
        if(!(e.getAction() == Action.RIGHT_CLICK_AIR)) return;
        if((e.getItem().getType() == Material.COMPASS) && (e.getItem().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.translateAlternateColorCodes('&', "&2Navigator"))))
        {
            p.openInventory(Inventorys.Navigator);
        }
    }
}