首页 > 解决方案 > 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?

标签: javaminecraftbukkit

解决方案


在 Spigot 1.13 中,材质略有不同,每种颜色的羊毛都有自己的名称。

更多信息:Spigot 文档


例如,如果您需要白色羊毛(它是 的默认颜色Material.WOOL),您将需要Material.WHITE_WOOL,并且您的代码将是:

ItemStack i = new ItemStack(Material.WHITE_WOOL);


推荐阅读