-
Nested Class Summary
Nested Classes
static class
Represents a mass selective crate opening session where multiple rewards are chosen.
static class
Represents a random crate opening session for a player.
static class
Represents a selective crate opening session for a player, where a specific reward is chosen.
-
Field Summary
Fields
protected Map<? extends Key,Integer>
The map of keys and their respective quantities consumed in this session.
protected final UUID
The player UUID associated with this crate opening session.
-
Method Summary
org.bukkit.entity.Player
Resolves the player from Bukkit at access-time.
abstract int
Abstract method to get the number of required keys for this crate opening session.
massSelective(org.bukkit.entity.Player player,
List<T> selectedRewards)
Creates a crate opening context for a mass selective crate opening session.
random(org.bukkit.entity.Player player,
boolean requireKeyInMainHand,
int openingQuantity)
Creates a crate opening context for a random crate opening session.
selective(org.bukkit.entity.Player player,
T selectedReward)
Creates a crate opening context for a selective crate opening session.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
playerId
protected final UUID playerId
The player UUID associated with this crate opening session.
-
keysAmount
protected Map<? extends Key,Integer> keysAmount
The map of keys and their respective quantities consumed in this session.
-
Method Details
-
getPlayer
public org.bukkit.entity.Player getPlayer()
Resolves the player from Bukkit at access-time.
- Returns:
- Online player for this context.
- Throws:
-
IllegalStateException - when the player cannot be resolved.
-
getRequiredKeys
public abstract int getRequiredKeys()
Abstract method to get the number of required keys for this crate opening session.
- Returns:
- The number of keys required for the session.
-
random
public static OpeningContext random(org.bukkit.entity.Player player,
boolean requireKeyInMainHand,
int openingQuantity)
Creates a crate opening context for a random crate opening session.
- Parameters:
-
player - The player participating in the session.
-
requireKeyInMainHand - Whether the key is required to be in the player's main hand.
-
openingQuantity - The number of openings to perform.
- Returns:
- A CrateOpeningContext instance representing the random crate opening session.
-
selective
public static <T extends Reward> OpeningContext selective(org.bukkit.entity.Player player,
T selectedReward)
Creates a crate opening context for a selective crate opening session.
- Type Parameters:
-
T - The type of reward.
- Parameters:
-
player - The player participating in the session.
-
selectedReward - The specific crate reward selected for the session.
- Returns:
- A CrateOpeningContext instance representing the selective crate opening session.
-
massSelective
public static <T extends Reward> OpeningContext massSelective(org.bukkit.entity.Player player,
List<T> selectedRewards)
Creates a crate opening context for a mass selective crate opening session.
- Type Parameters:
-
T - The type of reward.
- Parameters:
-
player - The player participating in the session.
-
selectedRewards - The list of rewards selected for the session. May contain duplicates.
- Returns:
- A CrateOpeningContext instance representing the mass selective crate opening session.