From 2642e438f02fd935d4e410b90e295ac39c0061ee Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 29 May 2024 06:50:05 +1000 Subject: [PATCH] #1014: Add PotionEffectTypeCategory to distinguish between beneficial and harmful effects By: 2008Choco --- .../org/bukkit/potion/PotionEffectType.java | 8 +++++++ .../potion/PotionEffectTypeCategory.java | 24 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 paper-api/src/main/java/org/bukkit/potion/PotionEffectTypeCategory.java diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java b/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java index 7feeb33f89..8b4032c82a 100644 --- a/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java +++ b/paper-api/src/main/java/org/bukkit/potion/PotionEffectType.java @@ -249,6 +249,14 @@ public abstract class PotionEffectType implements Keyed, Translatable { */ public abstract boolean isInstant(); + /** + * Returns the {@link PotionEffectTypeCategory category} of this effect type. + * + * @return the category + */ + @NotNull + public abstract PotionEffectTypeCategory getCategory(); + /** * Returns the color of this effect type. * diff --git a/paper-api/src/main/java/org/bukkit/potion/PotionEffectTypeCategory.java b/paper-api/src/main/java/org/bukkit/potion/PotionEffectTypeCategory.java new file mode 100644 index 0000000000..15a55a574c --- /dev/null +++ b/paper-api/src/main/java/org/bukkit/potion/PotionEffectTypeCategory.java @@ -0,0 +1,24 @@ +package org.bukkit.potion; + +/** + * Represents a category of {@link PotionEffectType} and its effect on an entity. + */ +public enum PotionEffectTypeCategory { + + /** + * Beneficial effects that positively impact an entity, such as Regeneration, + * Absorption, or Fire Resistance. + */ + BENEFICIAL, + /** + * Harmful effects that negatively impact an entity, such as Blindness, Wither, + * or Levitation. + */ + HARMFUL, + /** + * Neutral effects that have neither a positive nor negative effect on an + * entity, such as Glowing or Bad Omen. + */ + NEUTRAL; + +}