Estou em duvida com um codigo, Tou tentando fazer que quando ele clicar nessa Runa com um Beacon, o Beacon fique encantado e a ruma suma, Mas não tou conseguindo remover o item, Se pudessem me ajudar seria grato.
@EventHandler
public void onClick(InventoryClickEvent e) {
if (e.getCurrentItem() == null) return;
if (e.getCurrentItem().getType() == Material.AIR) return;
if (e.getCursor().getItemMeta() != null) {
if (e.getCursor().getItemMeta().getDisplayName() != null) {
if (e.getCursor().getType() != Material.AIR) {
if (e.getCursor().getItemMeta().getDisplayName().contains("§6Runa da Evolução") && e.getCurrentItem().getType() == Material.BEACON) {
Player p = (Player)e.getWhoClicked();
e.getCursor().setType(Material.AIR);
p.getInventory().removeItem(e.getCursor());
}
}
}
}
}