Class CommandReward
java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.reward.CommandReward
- All Implemented Interfaces:
AdvancementReward
An advancement reward that executes a command via the server console.
Placeholder "%player%" is substituted with the completing player's name.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<CommandReward> The codec used for serializing and deserializing the command reward.static final RewardType<CommandReward> The registered type definition for the command reward. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRewardType<?> getType()Retrieves the reward type definition associated with this instance.voidgrant(org.bukkit.entity.Player player) Grants the command reward by substituting placeholders and dispatching the command through the Bukkit console sender.
-
Field Details
-
CODEC
The codec used for serializing and deserializing the command reward. -
TYPE
The registered type definition for the command reward.
-
-
Constructor Details
-
CommandReward
Constructs a new CommandReward.- Parameters:
command- The command to execute. Use "%player%" as a target placeholder.
-
-
Method Details
-
getType
Description copied from interface:AdvancementRewardRetrieves the reward type definition associated with this instance. This is used to identify the logic and handle polymorphic serialization.- Specified by:
getTypein interfaceAdvancementReward- Returns:
- The
RewardTypecharacterizing 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:
grantin interfaceAdvancementReward- Parameters:
player- The player receiving the reward.
-