#Help
1 messages · Page 1 of 1 (latest)
hi
hmm i make a code but when break cobblestone nothing happen but when i remove
if (player.getItemInHand().equals(c1))
it working normal
what is c1
You should use descriptive variables
ItemStack item = new ItemStack(Material.WOOD_PICKAXE, 1);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(ChatColor.GRAY + "Wooden Hammer");
ArrayList<String> lore = new ArrayList<>();
lore.add("hammer!");
meta.setLore(lore);
item.setItemMeta(meta);
player.getInventory().addItem(item);
}```
c1 is private by customitem
private customItem c1 = new customItem();
Well you are trying to see if an ItemStack is equal to the customItem class
Also you should use descriptive variables. Instead of c1 use customItem
Also your classes should be capitalized like CustomItem instead of customItem
oh letme try
So what you would need to do
Is check if the lore of the item is equal to the lore of the custom item
Because when the durability changes it can be seen as a different item
and .equals wont work
sure it correct
?
but i switched from customitem to c1 so sure it's correct about lore both name
Im sorry, the language barrier is a bit hard to get around
You are going to have to use NBT, or PersistentDataContainer