Class CommandReward

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

public class CommandReward extends Object implements AdvancementReward
An advancement reward that executes a command via the server console. Placeholder "%player%" is substituted with the completing player's name.
  • Field Summary

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

    Constructors
    Constructor
    Description
    Constructs a new CommandReward.
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the reward type definition associated with this instance.
    void
    grant(org.bukkit.entity.Player player)
    Grants the command reward by substituting placeholders and dispatching the command through the Bukkit console sender.

    Methods inherited from class Object

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

    • CODEC

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

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

    • CommandReward

      public CommandReward(String command)
      Constructs a new CommandReward.
      Parameters:
      command - The command to execute. Use "%player%" as a target placeholder.
  • 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)
      Grants the command reward by substituting placeholders and dispatching the command through the Bukkit console sender.
      Specified by:
      grant in interface AdvancementReward
      Parameters:
      player - The player receiving the reward.