- All Known Subinterfaces:
-
AlternativeReward, Reward
public interface BaseReward
A base reward that defines common properties and behavior for all types of rewards.
This can be extended by more specific reward classes, such as alternative rewards or standard rewards.
-
Method Summary
Gets the display item for this reward.
String
Gets the unique identifier for this crate reward.
default int
default int
double
Gets the weight of this reward used for weighted-random selection.
List<String>
Gets the list of commands to be executed when the reward is won.
Retrieves a list of items that are awarded as part of this reward.
default boolean
Determines whether the player should receive a chat message when this
reward is given to them.
boolean
Determines if this reward is considered an alternative reward.
boolean
Checks whether this reward should be broadcasted to all players when it is won.
default boolean
Determines whether this reward should be shared only with players who are currently online.
-
Method Details
-
getIdentifier
String getIdentifier()
Gets the unique identifier for this crate reward.
The identifier is typically used to reference or track the reward within the crate system.
- Returns:
- the unique identifier for the reward.
-
getDisplayItem
@Nullable
@Nullable Item getDisplayItem()
Gets the display item for this reward.
The display item is shown as a visual representation of the reward in the UI.
- Returns:
- the Optional ItemStack representing the display item.
-
getWinItems
List<? extends Item> getWinItems()
Retrieves a list of items that are awarded as part of this reward.
This could be a collection of items given to the player.
- Returns:
- a list of ItemStacks representing the awarded items.
-
getWinCommands
List<String> getWinCommands()
Gets the list of commands to be executed when the reward is won.
Commands may include server-side actions like granting permissions or triggering events.
- Returns:
- a list of commands to execute upon winning this reward.
-
getWeight
double getWeight()
Gets the weight of this reward used for weighted-random selection.
Higher weight = higher probability relative to other rewards.
- Returns:
- the weight value of this reward.
-
isBroadcast
boolean isBroadcast()
Checks whether this reward should be broadcasted to all players when it is won.
Broadcasting allows the server to announce to all players that a reward has been won.
- Returns:
- true if the reward is broadcasted, false otherwise.
-
isSharePlayersOnline
default boolean isSharePlayersOnline()
Determines whether this reward should be shared only with players who are currently online.
When enabled, the reward's effects (such as items or commands) are only applied to players
who are online at the time the reward is given.
- Returns:
- true if the reward should be shared only among online players, false otherwise.
-
isAllowWinMessage
default boolean isAllowWinMessage()
Determines whether the player should receive a chat message when this
reward is given to them.
- Returns:
- true if the win message should be sent, false otherwise.
-
getMaxWinItemAmount
default int getMaxWinItemAmount()
-
getMaxWinCommandAmount
default int getMaxWinCommandAmount()
-
isAlternative
boolean isAlternative()
Determines if this reward is considered an alternative reward.
Alternative rewards can be awarded in place of the main reward.
- Returns:
- true if this is an alternative reward, false if it is a primary reward.