-- Import utilslocal itemStack =import("org.bukkit.inventory.ItemStack")local javaArrayList =import("java.util.ArrayList")local material =import("$.Material")-- Create inventorylocal title ="This is the inventory title"local slots =9local inv = plugin.getServer():createInventory(nil, slots, title)-- Create new item stacklocal countOfItems =1local newItemStack = luajava.new(itemStack, material.GRASS, countOfItems, 0)-- Get item meta from new item stacklocal meta = newItemStack:getItemMeta()-- Set new item textmeta:setDisplayName("WoW crazy item")-- Set new lore to itemlocal description = {"WoW this is a cool", "description O.o"}local list = luajava.new(javaArrayList)for i =1, #description do list:add(description[i])endmeta:setLore(list)-- Set the new item metanewItemStack:setItemMeta(meta)-- Set item to a slotlocal setSlot =0inv:setItem(setSlot, newItemStack)-- Open inventory for playerplayer:openInventory(inv)
This code allows you to set the item name and the lore text