I need help how can I do that a certain item in the inventory can't be changed so it always stays the same on a hotbar you just can't move and can't drop how can you query whether a player has a certain item?
You can use the InventoryClickEvent and the PlayerDropItemEvent for this.
And how exactly?
I already know which event I just don't know how to check whether it has a specific item with a name e.g. "& 7Profil"
You can simply use the events you are familiar with
itemstack.getItemMeta (). GetDisplayName (). Equals ("NAME DES ITEMS");
Query whether the item has a name or what its name is.
Okay thanks honor kiss
But for me there's a mistake
try {
if (ItemStack.getItemMeta (). GetDisplayName (). Equals ("NAME DES ITEMS")); {
e.setCancelled (true);
} else {
e.setCancelled (false);
}
} catch (exception e2) {
// TODO: handle exception
}
Thank you!
Now it works great!
A question how does that work when placing an item? I can't do it: /