-
Notifications
You must be signed in to change notification settings - Fork 0
J | Utility: EffectUtils
Sartaj Singh edited this page May 31, 2025
·
4 revisions
- 1. Overview
- 2. What is EffectUtils?
- 3. Basic Usage
- 4. API Reference
- 5. Advanced Patterns
- 6. Limitations & Troubleshooting
- 7. See Also
EffectUtils is a utility class in FXItems for working with potion effects (status effects) in Minecraft.
It provides a simple and consistent API for adding, removing, and checking potion effects on players or entities, especially in the context of custom item and food logic.
- Purpose: Makes it easy to manage Bukkit potion effects in your item, food, or ability code.
-
Scope: Only deals with potion effects.
(Does not handle particles, sounds, titles, or action bars—see other utilities for that.) - Usage: Designed for use in FXItemBehavior, FXFoodBehavior, and event listeners.
EffectUtils.addPotionEffect(player, PotionEffectType.SPEED, 200, 1); // Speed II for 10 seconds (200 ticks)EffectUtils.removePotionEffect(player, PotionEffectType.SPEED);if (EffectUtils.hasPotionEffect(player, PotionEffectType.REGENERATION)) {
// Player has regeneration
}// Adds a potion effect to a player or entity
void EffectUtils.addPotionEffect(LivingEntity entity, PotionEffectType effectType, int durationTicks, int amplifier);
// Removes a specific potion effect
void EffectUtils.removePotionEffect(LivingEntity entity, PotionEffectType effectType);
// Checks if an entity has a specific potion effect
boolean EffectUtils.hasPotionEffect(LivingEntity entity, PotionEffectType effectType);- entity: The player or mob to affect.
-
effectType: The type of effect (e.g.,
PotionEffectType.SPEED). - durationTicks: How long the effect lasts (20 ticks = 1 second).
- amplifier: Level (0 = I, 1 = II, etc).
-
Re-applying effects:
If you calladdPotionEffectagain with the same type, it will overwrite the previous effect. -
Stacking with other effects:
You can apply multiple different effects at once. -
Temporary buffs:
Use in conjunction with CooldownUtils or ManaUtils to limit ability usage.
-
Does not persist over logout:
Potion effects wear off with time or on disconnect. -
Not for visual/audio feedback:
Use other utility classes for particles, sounds, titles, etc. -
Effect conflicts:
Applying the same effect twice will overwrite, not stack.
- Home
- A | Getting Started & Plugin Overview
- B | The Registry System: Items, Foods, Commands, Events
- C | Creating Custom Items
- D | Creating Custom Foods
- E | Advanced: Custom Effects in FXItems
- F | Creating Custom Commands
- G | Creating Custom Events & Behaviors
- H | Utility: CooldownUtils
- I | Utility: CustomItemUtils
- J | Utility: EffectUtils
- K | Utility: ManaUtils
- L | Utility: OneTimeCraftUtils
- M | Utility: TeleportUtils
- N | Utility: ProjectileUtils
- O | Utility: GammaUtils
- P | Utility: EntitySizeUtils
- Q | FXItems API (com.noctify.API) & Making Addons
- R | Advanced Techniques, Gotchas & FAQ
- S | Auto-Registration System
- T | Migration Guide (v1.1 → v1.2+)
- U | Changelog