Package valorless.rarespawns.datamodels
Class SoulHarvesterUpgrade
java.lang.Object
valorless.rarespawns.datamodels.SoulHarvesterUpgrade
Data model describing a single Soul Harvester upgrade step.
An upgrade can modify item attributes, add enchantments, or grant a Soul Power once its conditions are met. Conditions include a souls requirement, optional entity type filter, and chance to apply. When successfully applied, a unique tag is written to the item's PersistentDataContainer to prevent duplicates.
Namespacing: each upgrade is addressed via a unique key composed of the owning
item id and a UUID. Use getNamespacedId() or getNamespacedKey().
-
Field Summary
FieldsModifier and TypeFieldDescriptionorg.bukkit.attribute.AttributeAttribute to modify: GENERIC_ATTACK_DAMAGE, GENERIC_MOVEMENT_SPEED, etc.Amount to modify the attribute byorg.bukkit.attribute.AttributeModifier.OperationOperation to apply the attribute modifier toorg.bukkit.inventory.EquipmentSlotGroupEquipment slot to apply the attribute modifier toChance (0.0 - 100.0) that this upgrade will be applied when conditions are metCustom model data value to set on the itemDisplay name to set on the itemEnchantment to apply: SHARPNESS, FIRE_ASPECT, etc.Level of the enchantment to applyWhether to override enchantment levels that are higher than this upgradeSpecific entity type required to unlock this upgrade, or null for anyItem model to set on the itemItem name to set on the itemLore lines to set on the itemLore lines to add to existing item loreNumber of souls required to unlock this upgradeSoul Power to apply: custom power defined in SoulPower classType of upgrade: ATTRIBUTE, ENCHANTMENT, POWER, MODELDATA, ITEMMODELParticle effect to play when this upgrade is unlocked, or null for noneSound to play when this upgrade is unlocked, or null for none -
Constructor Summary
ConstructorsConstructorDescriptionSoulHarvesterUpgrade(String id, String uuid, String type, Integer requiredSouls) Creates a SoulHarvesterUpgrade from raw string type.SoulHarvesterUpgrade(String id, String uuid, SoulHarvesterUpgradeType type, Integer requiredSouls) Creates a SoulHarvesterUpgrade with a resolved enum type. -
Method Summary
Modifier and TypeMethodDescriptionappliedUpgrades(org.bukkit.inventory.ItemStack item) applyUpgrade(org.bukkit.inventory.ItemStack item, org.bukkit.entity.Player player) Unique namespaced id for this upgrade instance.org.bukkit.NamespacedKeyUnique namespaced key for this upgrade instance, scoped to the plugin.toString()
-
Field Details
-
type
Type of upgrade: ATTRIBUTE, ENCHANTMENT, POWER, MODELDATA, ITEMMODEL -
requiredSouls
Number of souls required to unlock this upgrade -
entityType
Specific entity type required to unlock this upgrade, or null for any -
chance
Chance (0.0 - 100.0) that this upgrade will be applied when conditions are met -
unlockSound
Sound to play when this upgrade is unlocked, or null for none -
unlockParticle
Particle effect to play when this upgrade is unlocked, or null for none -
itemName
Item name to set on the item -
displayName
Display name to set on the item -
lore
Lore lines to set on the item -
loreAdd
Lore lines to add to existing item lore -
attribute
public org.bukkit.attribute.Attribute attributeAttribute to modify: GENERIC_ATTACK_DAMAGE, GENERIC_MOVEMENT_SPEED, etc. -
attributeAmount
Amount to modify the attribute by -
attributeOperation
public org.bukkit.attribute.AttributeModifier.Operation attributeOperationOperation to apply the attribute modifier to -
attributeSlot
public org.bukkit.inventory.EquipmentSlotGroup attributeSlotEquipment slot to apply the attribute modifier to -
enchantment
Enchantment to apply: SHARPNESS, FIRE_ASPECT, etc. -
enchantmentLevel
Level of the enchantment to apply -
enchantmentOverride
Whether to override enchantment levels that are higher than this upgrade -
soulPower
Soul Power to apply: custom power defined in SoulPower class -
customModelData
Custom model data value to set on the item -
itemModel
Item model to set on the item
-
-
Constructor Details
-
SoulHarvesterUpgrade
Creates a SoulHarvesterUpgrade from raw string type.- Parameters:
id- item id this upgrade belongs to (used for namespacing)uuid- unique identifier for this upgrade instancetype- upgrade type name (ATTRIBUTE, ENCHANTMENT, POWER, MODELDATA, etc.)requiredSouls- souls required to unlock/apply this upgrade- Throws:
IllegalArgumentException- if type is invalid
-
SoulHarvesterUpgrade
public SoulHarvesterUpgrade(String id, String uuid, SoulHarvesterUpgradeType type, Integer requiredSouls) Creates a SoulHarvesterUpgrade with a resolved enum type.- Parameters:
id- item id this upgrade belongs to (used for namespacing)uuid- unique identifier for this upgrade instancetype- upgrade type (ATTRIBUTE, ENCHANTMENT, POWER, MODELDATA, etc.)requiredSouls- souls required to unlock/apply this upgrade- Throws:
IllegalArgumentException- if type is null
-
-
Method Details
-
getNamespacedId
Unique namespaced id for this upgrade instance.- Returns:
- a stable namespaced id in the form SHU-
_
-
getNamespacedKey
public org.bukkit.NamespacedKey getNamespacedKey()Unique namespaced key for this upgrade instance, scoped to the plugin.- Returns:
- a NamespacedKey that can be used with PersistentDataContainer
-
applyUpgrade
-
appliedUpgrades
-
isApplied
-
toStringShort
-
toString
-