Package valorless.rarespawns.soulpower
Class SoulPowerManager
java.lang.Object
valorless.rarespawns.soulpower.SoulPowerManager
- All Implemented Interfaces:
org.bukkit.event.Listener
Manages Soul Powers and Soul Harvester progression for players.
Responsibilities include:
- Discovering soul powers and Soul Harvester items equipped or held by a player.
- Applying and checking cooldowns for powers.
- Evaluating unlock conditions and applying upgrades.
- Adding and persisting souls on items via PDC.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BooleanAdds souls to a Soul Harvester item, respecting the configured maxSouls cap.static BooleancheckConditions(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, ItemData data) Evaluates whether the given item now meets any Soul Harvester upgrade conditions and applies the first matching upgrade.static voidclearCooldown(org.bukkit.entity.Player player, String id) Clears any active cooldown for the given player's power.getSoulHarvesterItems(org.bukkit.entity.Player player) Lists all items in the player's inventory that contain a Soul Harvester component.getSoulPowers(org.bukkit.entity.Player player) Collects all soul powers available to the player from their equipped armor and main-hand item, regardless of trigger type.getSoulPowers(org.bukkit.entity.Player player, SoulPowerInfo.SoulPowerType type) Collects soul powers of a specific trigger type from the player's equipped armor and main-hand item.static BooleanisOnCooldown(org.bukkit.entity.Player player, String id) Checks whether the specified power is still on cooldown for the player.static booleanisPowerUnlocked(org.bukkit.entity.Player player, String id) Determines if any equipped item for the player has unlocked and applied the provided power ID.static booleanisWorldWhitelisted(org.bukkit.World world, SoulHarvesterComponent data) static voidsetCooldown(org.bukkit.entity.Player player, String id) Sets/refreshes the cooldown timestamp for a player's power to now.
-
Constructor Details
-
SoulPowerManager
public SoulPowerManager()
-
-
Method Details
-
getSoulPowers
Collects all soul powers available to the player from their equipped armor and main-hand item, regardless of trigger type.- Parameters:
player- the player to inspect- Returns:
- a map of powerId -> ItemData providing the power's source data, or null if none
-
getSoulHarvesterItems
public static HashMap<org.bukkit.inventory.ItemStack,ItemData> getSoulHarvesterItems(org.bukkit.entity.Player player) Lists all items in the player's inventory that contain a Soul Harvester component.- Parameters:
player- the player to inspect- Returns:
- a map of ItemStack -> ItemData for items with a Soul Harvester, or null if none
-
getSoulPowers
public static HashMap<String,ItemData> getSoulPowers(org.bukkit.entity.Player player, SoulPowerInfo.SoulPowerType type) Collects soul powers of a specific trigger type from the player's equipped armor and main-hand item.- Parameters:
player- the player to inspecttype- the trigger type to filter by- Returns:
- a map of powerId -> ItemData for matching powers, or null if none
-
isOnCooldown
Checks whether the specified power is still on cooldown for the player.- Parameters:
player- the playerid- the power ID- Returns:
- true if cooldown remains; false otherwise
-
setCooldown
Sets/refreshes the cooldown timestamp for a player's power to now.- Parameters:
player- the playerid- the power ID
-
clearCooldown
Clears any active cooldown for the given player's power.- Parameters:
player- the playerid- the power ID
-
checkConditions
public static Boolean checkConditions(org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack item, ItemData data) Evaluates whether the given item now meets any Soul Harvester upgrade conditions and applies the first matching upgrade. Plays an optional unlock SFX.- Parameters:
player- the owner of the item (used for sounds/feedback)item- the item to evaluatedata- the source item data containing Soul Harvester config- Returns:
- true if an upgrade was applied; false otherwise
-
addSouls
Adds souls to a Soul Harvester item, respecting the configured maxSouls cap.- Parameters:
item- the target itemamount- the number of souls to add- Returns:
- true if souls were added; false if the item is invalid or has no Soul Harvester
-
isPowerUnlocked
Determines if any equipped item for the player has unlocked and applied the provided power ID.- Parameters:
player- the player to scanid- the power ID to check- Returns:
- true if a matching upgrade tag is present on any relevant item; false otherwise
-
isWorldWhitelisted
-