-
Notifications
You must be signed in to change notification settings - Fork 0
Q | FXItems API (com.noctify.API) & Making Addons
- 1. Overview
- 2. What is the FXItems API?
- 3. Registry API: Registering Items, Foods, Commands, Events
- 4. Utils API: Using FXItems Utilities
- 5. Making Addons & Integration
- 6. API Reference: Methods and Patterns
- 7. Best Practices
- 8. See Also
The com.noctify.API package exposes the primary public API for FXItems.
It provides registry and utility interfaces that allow you to manage custom items, foods, commands, events, and to use powerful utility methods for gameplay features.
This API is designed for both addon/plugin developers and advanced server scripting.
FXItems API consists of two main interfaces:
-
Registry API (
Registry,RegistryAPI)
Lets you register and retrieve custom items, foods, commands, and events.
This is the main entrypoint for adding your own content. -
Utils API (
Utils,UtilsAPI)
Provides a wide range of utilities: cooldowns, custom item checks, potion effects, mana, projectiles, entity size, teleportation, and more.
Each has a concrete implementation (RegistryAPI, UtilsAPI) you instantiate and use.
Interface: com.noctify.API.Registry
Implementation: RegistryAPI
Registry registry = new RegistryAPI();
registry.registerItem("EXAMPLE_SWORD", new FXItemDefinition(...));-
itemNameis a unique string key for the item. -
FXItemDefinitiondefines the item's material, lore, abilities, etc.
registry.registerCommand(plugin, "example", ExampleCommand.class);or, for a command with default handling:
registry.registerCommand(plugin, "simplecommand");registry.registerEvent(plugin, ExampleListener.class);or
registry.registerEvent(plugin, "CustomEventName");registry.registerFood("MAGIC_BREAD", new FXFoodDefinition(...), new FXFoodBehavior(...));ItemStack item = registry.getCustomItem("EXAMPLE_SWORD");Interface: com.noctify.API.Utils
Implementation: UtilsAPI
Utils utils = new UtilsAPI();
utils.setCooldown(player.getUniqueId(), "ability_key", 30);
if (utils.isOnCooldown(player.getUniqueId(), "ability_key")) {
double secondsLeft = utils.getRemainingCooldown(player.getUniqueId(), "ability_key");
utils.sendCooldownMessage(player, "Ability Name", secondsLeft);
}
utils.clearAllCooldowns();if (utils.isCustomItem(item, Material.DIAMOND_SWORD, "§aExample Sword")) {
// handle custom item logic
}utils.addEffectWhileHolding(player, Material.BLAZE_ROD, PotionEffectType.FIRE_RESISTANCE, 200, 1);
// Removes all holding effects for a player:
utils.removeEffectTask(player);utils.setSize(player, 2.0f); // Double player size
utils.resetSize(player); // Reset to normal sizeutils.initializeManaUtils(plugin);
utils.setMana(player, 100);
boolean used = utils.useMana(player, 10);
int mana = utils.getMana(player);- Mana automatically regenerates and is displayed with an action bar.
utils.registerOneTimeCraft(oneTimeCraftUtils, "EXCALIBUR", excaliburItemStack);
Map<String, OneTimeCraftUtils.OneTimeCraftItem> items = utils.getRegisteredOneTimeCraftItems();utils.createCustomProjectile(
plugin,
player,
Particle.FLAME,
2,
true, // gravity
false, // glowing
1, // knockback
false, // silent
2.0, // speed
8.0, // damage
false, // speedBasedDamage
EntityType.ARROW,
false, // useModelEngine
"", // modelId
60, // despawn time (ticks)
0 // piercingLevel
);boolean success = utils.teleportPlayer(player, targetLocation, 40, true, true, true);- Teleports the player with distance checks, sound, and particles.
You can build your own plugins/addons that depend on FXItems:
-
Add FXItems as a dependency in your plugin’s
plugin.ymland build system (Maven/Gradle). -
Import
com.noctify.API.RegistryAPIandcom.noctify.API.UtilsAPI. -
Register your content in your plugin’s
onEnable()or initialization method, using the APIs above.
public class MyAddon extends JavaPlugin {
@Override
public void onEnable() {
Registry registry = new RegistryAPI();
Utils utils = new UtilsAPI();
// Register a custom item, command, or event
registry.registerItem("MY_ITEM", new FXItemDefinition(...));
}
}- You can retrieve and use all utilities (mana, cooldowns, size, projectiles, etc.) via
UtilsAPI. - If your addon is providing new commands/events, register them through the API, not directly.
void registerItem(String itemName, FXItemDefinition itemDefinition)ItemStack getCustomItem(String itemName)void registerCommand(Plugin plugin, String commandName, Class<? extends CommandExecutor> commandClass)void registerCommand(Plugin plugin, String commandName)void registerEvent(Plugin plugin, Class<? extends Listener> eventClass)void registerEvent(Plugin plugin, String eventName)void registerFood(String foodName, FXFoodDefinition definition, FXFoodBehavior behavior)
boolean isOnCooldown(UUID playerId, String key)double getRemainingCooldown(UUID playerId, String key)void setCooldown(UUID playerId, String key, int seconds)void sendCooldownMessage(Player player, String itemName, double timeLeft)void clearAllCooldowns()boolean isCustomItem(ItemStack item, Material material, String displayName)void addEffectWhileHolding(Player player, Material itemMaterial, PotionEffectType effectType, int duration, int amplifier)void removeEffectTask(Player player)void setSize(Entity entity, float scale)void resetSize(Entity entity)void initializeManaUtils(Plugin plugin)boolean useMana(Player player, int amount)void setMana(Player player, int amount)int getMana(Player player)void registerOneTimeCraft(OneTimeCraftUtils instance, String name, ItemStack item)Map<String, OneTimeCraftUtils.OneTimeCraftItem> getRegisteredOneTimeCraftItems()void initializeProjectileUtils(Plugin plugin)-
void createCustomProjectile(...) boolean teleportPlayer(Player player, Location targetLocation, int maxDistance, boolean preserveDirection, boolean playSound, boolean spawnParticles)
- Always use the API, not internal maps or static fields.
- Check for plugin dependencies (EntitySize, ModelEngine) before using related features.
-
Use interface types (
Registry,Utils) for forward compatibility. -
Register all your custom content in your plugin’s
onEnable()or init routine. - Test your integration on a dev server before deploying to production.
- A | Getting Started & Plugin Overview
- B | The Registry System
- All Utility Reference
- Sample Addons & Custom Content
- Full API Source (GitHub)
- FXItems README
- 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