Class ConfigLootItem
java.lang.Object
com.ryandw11.structure.loottables.ConfigLootItem
- All Implemented Interfaces:
LootItem
- Direct Known Subclasses:
CustomLootItem
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 Summary
ConstructorDescriptionConfigLootItem(LootTable lootTable, String itemID, int weight, String amount)
The default constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
constructItem(org.bukkit.configuration.ConfigurationSection configurationSection)
This is called whenConfigLootTable
processes a custom loot item.int
The amount of the item.The id of the item.The loot table that the item exists in.The raw amount of the item.int
The weight of the item.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ryandw11.structure.loottables.LootItem
getItemStack
-
Constructor Details
-
ConfigLootItem
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 whenConfigLootTable
processes a custom loot item.- Parameters:
configurationSection
- The configuration section of the loot item.
-
getLootTable
The loot table that the item exists in.- Returns:
- The loot table that the item exists in.
-
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. (SeeNumberStylizer.getStylizedInt(String)
).- Returns:
- The amount of the item.
-
getRawAmount
The raw amount of the item.- Returns:
- The raw amount of the item.
-