Class ConfigLootItem

java.lang.Object
com.ryandw11.structure.loottables.ConfigLootItem
All Implemented Interfaces:
LootItem
Direct Known Subclasses:
CustomLootItem

public abstract class ConfigLootItem extends Object implements LootItem
This class allows you to create custom loot items to be used by users in the LootTable config files.

Create a new class that extends this class and use CustomStructureAddon.registerLootItem(String, Class) to register the item.

Ensure any implementations include a construct that exactly matches the constructor defined by this class.

  • Constructor Details

    • ConfigLootItem

      public ConfigLootItem(LootTable lootTable, String itemID, int weight, String amount)
      The default constructor. There must exist a constructor in all child classes that has the same parameters.
      Parameters:
      lootTable - The loot table.
      itemID - The itemID.
      weight - The weight.
      amount - The raw amount.
  • Method Details

    • constructItem

      public abstract void constructItem(org.bukkit.configuration.ConfigurationSection configurationSection)
      This is called when ConfigLootTable processes a custom loot item.
      Parameters:
      configurationSection - The configuration section of the loot item.
    • getLootTable

      public final LootTable getLootTable()
      The loot table that the item exists in.
      Returns:
      The loot table that the item exists in.
    • getItemID

      public final String getItemID()
      The id of the item.
      Returns:
      The id of the item.
    • getWeight

      public final int getWeight()
      The weight of the item.
      Returns:
      The weight of the item.
    • getAmount

      public final int getAmount()
      The amount of the item. The raw amount is processed as a stylized integer. (See NumberStylizer.getStylizedInt(String)).
      Returns:
      The amount of the item.
    • getRawAmount

      public final String getRawAmount()
      The raw amount of the item.
      Returns:
      The raw amount of the item.