-
Notifications
You must be signed in to change notification settings - Fork 0
R | Advanced Techniques, Gotchas & FAQ
You can register items, foods, commands, and events at runtime, not just during plugin startup.
This is useful for:
- Addons loading content after FXItems.
- Reloadable packs.
- Dynamic event- or time-based registration.
Example:
Registry registry = new RegistryAPI();
registry.registerItem("DYNAMIC_SWORD", new FXItemDefinition(...));You can use the FXItems UtilsAPI in any plugin that depends on FXItems — you are not limited to FXItems' internal logic.
Example:
Utils utils = new UtilsAPI();
utils.setSize(player, 1.5f);- Implement custom
ItemBehaviororFXFoodBehaviorclasses. - Register listeners for custom events (e.g.,
LegendaryItemCraftListener). - Access the registry and utility APIs from within your custom handlers.
- Add FXItems as a dependency in your own plugin.
- Use both
RegistryAPIandUtilsAPIto register content and use utilities. - See Q | FXItems API & Making Addons for full patterns.
- FXItems will use ModelEngine for projectiles if
useModelEngine = trueand ModelEngine is present. - EntitySize features (like size changes) are only available if the EntitySize plugin is installed.
- Always check for feature availability before calling size/model methods.
- Don’t register items/foods/commands/events directly into static maps.
- Always use the
RegistryAPI. - Ensure registration occurs after FXItems has loaded.
- ModelEngine: Required for custom model projectiles. If missing, projectiles will fallback to standard entities or throw errors if explicitly requested.
- EntitySize: Needed for resizing entities/players. If missing, size-related functions will be no-ops or log warnings.
- PlaceholderAPI: Only needed for placeholder integration.
- Check plugin.yml for permissions like
fxitems.nightvision,fxitems.op, andfxitems.utils. - Make sure your players/groups have the proper permissions for custom commands or utilities.
- If making an addon, set
depend: [FXItems]orsoftdepend: [FXItems]in yourplugin.yml. - Register your content in
onEnableor after FXItems has initialized.
- Use the exact display name (with color codes) and material in
isCustomItem. - Lore or metadata mismatches will cause custom item checks to fail.
- Call
utils.initializeManaUtils(plugin)in your plugin or ensure FXItems has initialized mana tracking. - Mana only regenerates for players who have recently used mana.
- If using ModelEngine, confirm it’s installed and enabled before calling ModelEngine projectile methods.
- Ensure all parameters for
createCustomProjectileare valid, especiallymodelIdifuseModelEngineis true.
- Use
OneTimeCraftUtilsor the relevant API methods, not your own tracking. - Remember: one-time crafts are not persistent across server restarts unless you add your own persistence.
Q: How do I add a new custom item?
A: Create an FXItemDefinition and register it via RegistryAPI.registerItem.
Q: How do I check if an ItemStack is a specific FXItem?
A: Use UtilsAPI.isCustomItem(item, material, displayName).
Q: Can I use FXItems utilities in another plugin?
A: Yes, as long as you depend on FXItems and instantiate UtilsAPI.
Q: Can I reload FXItems without restarting the server?
A: Use /fxreload to reload configuration, but for full registry reload, restart the server.
Q: Where are my items/foods/commands/events registered?
A: In your plugin’s onEnable, using the RegistryAPI or equivalent.
Q: How do I make an item/food/command only available once?
A: Use OneTimeCraftUtils or the relevant utility API methods.
Q: My custom ability isn’t triggering!
A: Check event registration, item checks, and that your class implements the right interfaces.
Q: How do I add support for PlaceholderAPI?
A: Use PlaceholderAPI’s registration methods and FXItems hooks, if available.
- Q | FXItems API (com.noctify.API) & Making Addons
- P | Utility: EntitySizeUtils
- N | Utility: ProjectileUtils
- Sample Items, Foods, Commands, Events
- 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