Class SoulHarvesterUpgrade

java.lang.Object
valorless.rarespawns.datamodels.SoulHarvesterUpgrade

public class SoulHarvesterUpgrade extends Object
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 Details

    • type

      Type of upgrade: ATTRIBUTE, ENCHANTMENT, POWER, MODELDATA, ITEMMODEL
    • requiredSouls

      public Integer requiredSouls
      Number of souls required to unlock this upgrade
    • entityType

      public String entityType
      Specific entity type required to unlock this upgrade, or null for any
    • chance

      public Double chance
      Chance (0.0 - 100.0) that this upgrade will be applied when conditions are met
    • unlockSound

      public Sound unlockSound
      Sound to play when this upgrade is unlocked, or null for none
    • unlockParticle

      public Particle unlockParticle
      Particle effect to play when this upgrade is unlocked, or null for none
    • itemName

      public String itemName
      Item name to set on the item
    • displayName

      public String displayName
      Display name to set on the item
    • lore

      public List<String> lore
      Lore lines to set on the item
    • loreAdd

      public List<String> loreAdd
      Lore lines to add to existing item lore
    • attribute

      public org.bukkit.attribute.Attribute attribute
      Attribute to modify: GENERIC_ATTACK_DAMAGE, GENERIC_MOVEMENT_SPEED, etc.
    • attributeAmount

      public Double attributeAmount
      Amount to modify the attribute by
    • attributeOperation

      public org.bukkit.attribute.AttributeModifier.Operation attributeOperation
      Operation to apply the attribute modifier to
    • attributeSlot

      public org.bukkit.inventory.EquipmentSlotGroup attributeSlot
      Equipment slot to apply the attribute modifier to
    • enchantment

      public String enchantment
      Enchantment to apply: SHARPNESS, FIRE_ASPECT, etc.
    • enchantmentLevel

      public Integer enchantmentLevel
      Level of the enchantment to apply
    • enchantmentOverride

      public Boolean enchantmentOverride
      Whether to override enchantment levels that are higher than this upgrade
    • soulPower

      public String soulPower
      Soul Power to apply: custom power defined in SoulPower class
    • customModelData

      public Integer customModelData
      Custom model data value to set on the item
    • itemModel

      public String itemModel
      Item model to set on the item
  • Constructor Details

    • SoulHarvesterUpgrade

      public SoulHarvesterUpgrade(String id, String uuid, String type, Integer requiredSouls)
      Creates a SoulHarvesterUpgrade from raw string type.
      Parameters:
      id - item id this upgrade belongs to (used for namespacing)
      uuid - unique identifier for this upgrade instance
      type - 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 instance
      type - upgrade type (ATTRIBUTE, ENCHANTMENT, POWER, MODELDATA, etc.)
      requiredSouls - souls required to unlock/apply this upgrade
      Throws:
      IllegalArgumentException - if type is null
  • Method Details

    • getNamespacedId

      public String 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

      public Boolean applyUpgrade(org.bukkit.inventory.ItemStack item, org.bukkit.entity.Player player)
    • appliedUpgrades

      public List<String> appliedUpgrades(org.bukkit.inventory.ItemStack item)
    • isApplied

      public Boolean isApplied(List<String> appliedUpgrades)
    • toStringShort

      public String toStringShort()
    • toString

      public String toString()
      Overrides:
      toString in class Object