Class ItemReward

java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.reward.ItemReward
All Implemented Interfaces:
AdvancementReward

public class ItemReward extends Object implements AdvancementReward
An advancement reward that directly grants a specific ItemStack to the player.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Codec<ItemReward>
    The codec used for serializing and deserializing the item reward.
    static final RewardType<ItemReward>
    The registered type definition for the item reward.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemReward(org.bukkit.inventory.ItemStack item)
    Constructs a new ItemReward.
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the reward type definition associated with this instance.
    void
    grant(org.bukkit.entity.Player player)
    Adds the item to the player's inventory, dropping any remainder on the ground.

    Methods inherited from class Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CODEC

      public static final Codec<ItemReward> CODEC
      The codec used for serializing and deserializing the item reward.
    • TYPE

      public static final RewardType<ItemReward> TYPE
      The registered type definition for the item reward.
  • Constructor Details

    • ItemReward

      public ItemReward(org.bukkit.inventory.ItemStack item)
      Constructs a new ItemReward.
      Parameters:
      item - The stack to distribute.
  • Method Details

    • getType

      public RewardType<?> getType()
      Description copied from interface: AdvancementReward
      Retrieves the reward type definition associated with this instance. This is used to identify the logic and handle polymorphic serialization.
      Specified by:
      getType in interface AdvancementReward
      Returns:
      The RewardType characterizing this specific reward.
    • grant

      public void grant(org.bukkit.entity.Player player)
      Adds the item to the player's inventory, dropping any remainder on the ground.
      Specified by:
      grant in interface AdvancementReward
      Parameters:
      player - The player receiving the reward.