Expand PotionMeta Api to allow getting effective potion colour and effects (#12390)

This commit is contained in:
Isaac - The456
2025-05-02 21:31:39 +01:00
committed by GitHub
parent 825685f82f
commit 2bd84f6f0e
4 changed files with 83 additions and 0 deletions

View File

@@ -8,6 +8,7 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.Unmodifiable;
/**
* Represents a potion or item that can have custom effects.
@@ -74,6 +75,16 @@ public interface PotionMeta extends ItemMeta {
@NotNull
List<PotionEffect> getCustomEffects();
/**
* All effects that this potion meta holds.
* <p>
* This is a combination of the base potion type and any custom effects.
*
* @return an unmodifiable list of all effects.
*/
@NotNull
@Unmodifiable List<PotionEffect> getAllEffects();
/**
* Adds a custom potion effect to this potion.
*
@@ -146,6 +157,16 @@ public interface PotionMeta extends ItemMeta {
*/
void setColor(@Nullable Color color);
/**
* Computes the effective colour of this potion meta.
* <p>
* This blends all custom effects, or uses a default fallback color.
*
* @return the effective potion color
*/
@NotNull
Color computeEffectiveColor();
/**
* Checks for existence of a custom potion name translation suffix.
*