Discussion in 'Plugin Development' started by Kicksy, Nov 28, 2019.
I want to check if an item ID exists. Is there a way without creating a long id list manually?
Minecraft has a maximum number of item ids, so just check that the item ID is less than or equal to 2267 (in the latest version)
And in the 1.8.8? There are some IDs missing.
Do the same thing, but also include a list of missing IDs, if the ID is in the missing list, or is greater than the maximum item ID, then it's invalid.
You could create an ItemStack using the ID then check if the resultant is of type AIR. If it is, it's a bad id.
Unless the ID is 0, in which case, they wanted air.
I figured that was obvious, heh.
Separate names with a comma.