Search in sources :

Example 1 with KnowledgeBookMeta

use of org.bukkit.inventory.meta.KnowledgeBookMeta in project Denizen-For-Bukkit by DenizenScript.

the class ItemKnowledgeBookRecipes method adjust.

@Override
public void adjust(Mechanism mechanism) {
    // -->
    if (mechanism.matches("knowledge_book_recipes")) {
        KnowledgeBookMeta meta = (KnowledgeBookMeta) item.getItemMeta();
        List<NamespacedKey> recipes = new ArrayList<>();
        ListTag newRecipes = mechanism.valueAsType(ListTag.class);
        for (String str : newRecipes) {
            recipes.add(Utilities.parseNamespacedKey(str));
        }
        meta.setRecipes(recipes);
        item.setItemMeta(meta);
    }
}
Also used : KnowledgeBookMeta(org.bukkit.inventory.meta.KnowledgeBookMeta) NamespacedKey(org.bukkit.NamespacedKey) ArrayList(java.util.ArrayList) ListTag(com.denizenscript.denizencore.objects.core.ListTag)

Aggregations

ListTag (com.denizenscript.denizencore.objects.core.ListTag)1 ArrayList (java.util.ArrayList)1 NamespacedKey (org.bukkit.NamespacedKey)1 KnowledgeBookMeta (org.bukkit.inventory.meta.KnowledgeBookMeta)1