可能是一个愚蠢的问题,但是如果我在方法中使用cannot resolve
,则会显示一条消息getPersistentDataContainer()
。我该如何解决?
private ItemStack createItem(String name, ArrayList<String> lore, Material mat, String itemfunc, int amount) {
ItemStack iStack = new ItemStack(mat, amount);
ItemMeta iMeta = iStack.getItemMeta();
iMeta.getPersistentDataContainer().set(this.ITEMFUNC, PersistentDataType.STRING, itemfunc);
iMeta.setDisplayName(name);
iMeta.setLore(lore);
iStack.setItemMeta(iMeta);
return iStack;
}
已解决:
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
仅当使用VaultAPI时,才必须排除org.bukkit
。这样我们就可以从原始依赖项中使用它了