Class ConsumableApplyEffect

java.lang.Object
valorless.rarespawns.builders.components.ConsumableApplyEffect
All Implemented Interfaces:
org.bukkit.configuration.serialization.ConfigurationSerializable, org.bukkit.inventory.meta.components.consumable.effects.ConsumableApplyEffects, org.bukkit.inventory.meta.components.consumable.effects.ConsumableEffect

public class ConsumableApplyEffect extends Object implements org.bukkit.inventory.meta.components.consumable.effects.ConsumableApplyEffects
Represents a consumable effect for RareSpawns items. Implements ConsumableApplyEffects to apply potion effects with a probability when consumed. Supports serialization and deserialization for configuration storage.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConsumableApplyEffect(List<org.bukkit.potion.PotionEffect> effects, float probability)
    Constructs a ConsumableApplyEffect with a list of effects and probability.
    ConsumableApplyEffect(org.bukkit.potion.PotionEffect... effects)
    Constructs a ConsumableApplyEffect with one or more potion effects (always applies).
    ConsumableApplyEffect(org.bukkit.potion.PotionEffect effect, float probability)
    Constructs a ConsumableApplyEffect with a single effect and probability.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.bukkit.potion.PotionEffect
    addEffect(org.bukkit.potion.PotionEffect effect)
    Adds a potion effect to the list.
    Deserializes a ConsumableApplyEffect from configuration data.
    List<org.bukkit.potion.PotionEffect>
    Gets an immutable list of potion effects to apply.
    float
    Gets the probability that the effects are applied.
    Serializes the ConsumableApplyEffect for configuration storage.
    void
    setEffects(List<org.bukkit.potion.PotionEffect> effects)
    Sets the list of potion effects to apply.
    void
    setProbability(float probability)
    Sets the probability that the effects are applied.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConsumableApplyEffect

      public ConsumableApplyEffect(org.bukkit.potion.PotionEffect... effects)
      Constructs a ConsumableApplyEffect with one or more potion effects (always applies).
      Parameters:
      effects - One or more PotionEffect objects.
    • ConsumableApplyEffect

      public ConsumableApplyEffect(org.bukkit.potion.PotionEffect effect, float probability)
      Constructs a ConsumableApplyEffect with a single effect and probability.
      Parameters:
      effect - The PotionEffect to apply.
      probability - The probability to apply the effect (0.0-1.0).
    • ConsumableApplyEffect

      public ConsumableApplyEffect(List<org.bukkit.potion.PotionEffect> effects, float probability)
      Constructs a ConsumableApplyEffect with a list of effects and probability.
      Parameters:
      effects - List of PotionEffect objects.
      probability - The probability to apply the effects (0.0-1.0).
  • Method Details

    • getEffects

      public List<org.bukkit.potion.PotionEffect> getEffects()
      Gets an immutable list of potion effects to apply.
      Specified by:
      getEffects in interface org.bukkit.inventory.meta.components.consumable.effects.ConsumableApplyEffects
      Returns:
      List of PotionEffect objects.
    • setEffects

      public void setEffects(List<org.bukkit.potion.PotionEffect> effects)
      Sets the list of potion effects to apply.
      Specified by:
      setEffects in interface org.bukkit.inventory.meta.components.consumable.effects.ConsumableApplyEffects
      Parameters:
      effects - List of PotionEffect objects.
    • addEffect

      public org.bukkit.potion.PotionEffect addEffect(org.bukkit.potion.PotionEffect effect)
      Adds a potion effect to the list.
      Specified by:
      addEffect in interface org.bukkit.inventory.meta.components.consumable.effects.ConsumableApplyEffects
      Parameters:
      effect - The PotionEffect to add.
      Returns:
      The added PotionEffect.
    • getProbability

      public float getProbability()
      Gets the probability that the effects are applied.
      Specified by:
      getProbability in interface org.bukkit.inventory.meta.components.consumable.effects.ConsumableApplyEffects
      Returns:
      Probability value (0.0-1.0).
    • setProbability

      public void setProbability(float probability)
      Sets the probability that the effects are applied.
      Specified by:
      setProbability in interface org.bukkit.inventory.meta.components.consumable.effects.ConsumableApplyEffects
      Parameters:
      probability - Probability value (0.0-1.0).
    • serialize

      public Map<String,Object> serialize()
      Serializes the ConsumableApplyEffect for configuration storage.
      Specified by:
      serialize in interface org.bukkit.configuration.serialization.ConfigurationSerializable
      Returns:
      Map of serialized data.
    • deserialize

      public static ConsumableApplyEffect deserialize(Map<String,Object> map)
      Deserializes a ConsumableApplyEffect from configuration data.
      Parameters:
      map - The serialized data map.
      Returns:
      A new ConsumableApplyEffect instance.