Search code examples
javaminecraftbukkit

Spigot Material WOOL doesn't exist anymore


I'm working on a big spigot plugin with a menu made with an inventory, and in this inventory, I add wools like choices for the player.

I use the following line to create my ItemStack:

ItemStack i = new ItemStack(Material.WOOL);

But I have the following error since spigot was updated in 1.13:

WOOL cannot be resolved or is not a field

Does someone know why, and how to update through the correct way?


Solution

  • In Spigot 1.13, Materials are a little bit different, and each color of Wool got it's own name.

    More information: Spigot documentation


    For instance, if you need a White Wool (It was the default color for Material.WOOL), you'll need Material.WHITE_WOOL, and your code will be:

    ItemStack i = new ItemStack(Material.WHITE_WOOL);