Solved Material Visability

Jan

New member
Apr 15, 2024
5
0
1
Hello everyone,

I had a problem while programming plugin. One feature of this plugin should be the random distribution of items.
There are a few Items that the player should not the solution of this problem is a simple Blacklist (CommandBlock...)

But there are also items that are not visible for the player like the potatoes, carrotes, all kinds of WALL_HEADS, all kinds of POTTED_ Materials....
I could check the name if the material contains this name but the question is there is a better option to check if this material is visible (and useable for the palyer)

The third restriction is that some Materials are already in the material list but are not implementet in the Version of the game like in the 1.19 there was all the cherry stuf inside the material list, the player gets the items but cannot interact or use the items. The solution for this problem is realy simple
Java:
material.isEnabledByFeature(Bukkit.getWorlds().get(0))

The problem is how can i detect if the material is only an world object like the potatoes or if the player is able to use them in their inventory? Is there a solution of this problem or have i to use a simple blacklist?