I'm writing on a map plugin, to deny copyright protected maps. The maps have a lore and if the lore is on the map, it couldn't be copied.
This works fine with the Player-Crafting Inventory and the Workbench Inventory. On click onto the map in the Result slot, I can cancel the event. But this doesn't works with the Cartography Table.
If I check every Slot of the Cartography Table and first put the filled map in and then the empty map, the event will be canceled. If I put first an empty map in and then the filled map, the event wouldn't be canceled and I can click on the Result Slot and get the maps copied.
if(e.getClickedInventory().getItem(0) != null) { if(e.getClickedInventory().getItem(0).hasItemMeta()) { ItemMeta iMeta = e.getClickedInventory().getItem(0).getItemMeta(); if(iMeta.hasLore()) { List<String> iLore = e.getClickedInventory().getItem(0).getItemMeta().getLore(); String str = ChatColor.stripColor(String.valueOf(iLore)); String original = "Original"; String copy = "Copy"; if(str.contains(original) || str.contains(copy)) { e.setCancelled(true); p.closeInventory(); p.sendMessage("Can not be copied"); return; } } } }