From e46e33f5e2494732b418aaf85fb52cefe59e9a8b Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 8 Feb 2024 22:54:45 +1100 Subject: [PATCH] SPIGOT-7576, #970: Add methods in MushroomCow to change stew effects By: Doc --- .../java/org/bukkit/entity/MushroomCow.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/entity/MushroomCow.java b/paper-api/src/main/java/org/bukkit/entity/MushroomCow.java index 939a3dbfcf..cef1700834 100644 --- a/paper-api/src/main/java/org/bukkit/entity/MushroomCow.java +++ b/paper-api/src/main/java/org/bukkit/entity/MushroomCow.java @@ -1,5 +1,8 @@ package org.bukkit.entity; +import java.util.List; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import org.jetbrains.annotations.NotNull; /** @@ -7,6 +10,63 @@ import org.jetbrains.annotations.NotNull; */ public interface MushroomCow extends Cow { + /** + * Checks for the presence of custom potion effects to be applied to the + * next suspicious stew received from milking this {@link MushroomCow}. + * + * @return true if custom potion effects are applied to the stew + */ + boolean hasEffectsForNextStew(); + + /** + * Gets an immutable list containing all custom potion effects applied to + * the next suspicious stew received from milking this {@link MushroomCow}. + *

+ * Plugins should check that hasCustomEffects() returns true before calling + * this method. + * + * @return an immutable list of custom potion effects + */ + @NotNull + List getEffectsForNextStew(); + + /** + * Adds a custom potion effect to be applied to the next suspicious stew + * received from milking this {@link MushroomCow}. + * + * @param effect the potion effect to add + * @param overwrite true if any existing effect of the same type should be + * overwritten + * @return true if the effects to be applied to the suspicious stew changed + * as a result of this call + */ + boolean addEffectToNextStew(@NotNull PotionEffect effect, boolean overwrite); + + /** + * Removes a custom potion effect from being applied to the next suspicious + * stew received from milking this {@link MushroomCow}. + * + * @param type the potion effect type to remove + * @return true if the effects to be applied to the suspicious stew changed + * as a result of this call + */ + boolean removeEffectFromNextStew(@NotNull PotionEffectType type); + + /** + * Checks for a specific custom potion effect type to be applied to the next + * suspicious stew received from milking this {@link MushroomCow}. + * + * @param type the potion effect type to check for + * @return true if the suspicious stew to be generated has this effect + */ + boolean hasEffectForNextStew(@NotNull PotionEffectType type); + + /** + * Removes all custom potion effects to be applied to the next suspicious + * stew received from milking this {@link MushroomCow}. + */ + void clearEffectsForNextStew(); + /** * Get the variant of this cow. *