entity.remove() // this will mark it for removing
@EventHandler
public void itemVanish2(ItemDespawnEvent e) {
ItemStack i = e.getEntity().getItemStack();
if(i.getItemMeta().getLore().contains("FLOATING"))
event.setCancelled(true); // cancel the event, so item does not despawn
}
}