-
Notifications
You must be signed in to change notification settings - Fork 0
K | Utility: ManaUtils
Sartaj Singh edited this page May 29, 2025
·
6 revisions
ManaUtils provides a full system for player mana, including spending, setting, checking, and displaying mana values.
What it does:
Sets up the mana system. Must be called once in your plugin's onEnable().
Example:
ManaUtils.initialize(this);What it does:
Attempts to spend the specified amount of mana. Returns false if not enough mana.
Example:
if (!ManaUtils.useMana(player, 10)) {
player.sendMessage("Not enough mana!");
return;
}What it does:
Sets the player's current mana to the given amount.
Example:
ManaUtils.setMana(player, 100);What it does:
Returns the player's current mana.
Example:
int mana = ManaUtils.getMana(player);What it does:
Adds the given amount to the player's mana.
Example:
ManaUtils.addMana(player, 5);What it does:
Returns the player's maximum mana.
Example:
int maxMana = ManaUtils.getMaxMana(player);What it does:
Displays or updates a mana bar for the player.
Example:
ManaUtils.showManaBar(player);- Always call
initializeat startup. - Use
useManain abilities to consume mana. - Use
showManaBarafter changing mana for instant feedback. - Adjust
getMaxManaif you want dynamic maximums (e.g., leveling).
- 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