⭐
StarAPI Documentation
  • ⭐API Information
    • ❔About Our API's
    • ⬇️Installing Our API
  • 🌟StarAPI (Spigot/Paper)
    • 📂Abilities
      • ⏳Transmition
      • 🤯Implosion
      • 🏹MultiShot
    • 📂Builders
      • 👕Armor Builder
      • 📊Bossbar Builder
      • ☄️Command Builder
      • ⚔️Item Builder
      • 🧟‍♂️Mob Builder
      • 💯Scoreboard Builder
      • 🔗Webhook Builder
      • 🔨Message Builder
      • 🏗️Actionbar Builder
    • 📂Files
      • 📃Create Files
      • 📁Create Folders
      • 📖Read Files
      • 🖊️Write Files
    • 📂Inventory Utilities
      • 💎Animated Items
      • 📖Book Content
      • 📔Book GUI
      • 🎞️Filler
      • 🪁Inventory Items
      • 📝Inventory Name
      • 💀Inventory Skulls
    • 📂Message Utilities
      • 🤖Auto Responses
      • 🎨Message Colors
    • 📂Recipes
      • ⚒️Crafting Recipes
      • 🧑‍🍳Furnace Recipes
    • 📂Timers
      • 🕙Active Timers
      • ❌Cancel Timers
      • 🕙Delayed Timers
      • 🕐Create Timers
    • 📂Misc
      • 💀Give Skulls
      • 📈Progress Bars
      • ⬛Block Placer
Powered by GitBook
On this page
  • Overview
  • Methods
  • Notes
  1. StarAPI (Spigot/Paper)
  2. Inventory Utilities

Inventory Items

Add items to inventories

Overview

The InventoryItems class provides a utility method for adding custom items to an inventory in a Minecraft Bukkit server environment. This class simplifies the process of customizing item properties such as name and lore before adding them to the inventory.

Methods

addItemToInventory

public static void addItemToInventory(Inventory inventory, Material material, int amount, int slot, String itemName, String... lore)

Adds a custom item to the specified inventory with the provided properties.

Parameters

  • inventory: The inventory to which the item will be added.

  • material: The material type of the item.

  • amount: The quantity of the item.

  • slot: The slot in the inventory where the item will be placed.

  • itemName: The display name of the item.

  • lore: Optional lore lines for the item.

Description

This method creates a custom item with the specified material, amount, display name, and lore. It then adds the item to the inventory at the specified slot. If the slot is invalid (outside the inventory bounds), the item is added to the inventory's contents instead.

Notes

  • The InventoryItems class offers a convenient way to add custom items to inventories in Bukkit plugins.

  • Developers can use the addItemToInventory method to dynamically create and add items with custom properties such as name and lore.

  • Customizing item properties allows for enhanced player interaction and improved visual presentation in inventory interfaces.

PreviousFillerNextInventory Name

Last updated 1 year ago

🌟
📂
🪁