Skip to content

API: usage

Timothé ROSAZ edited this page Apr 16, 2025 · 9 revisions

This plugin has been made with extensibility in mind. You'll find a large panel of customizable elements.

How-to: add the dependency

Using maven, add the following dependency (inside the <depencendies> tag in your pom.xml) :

<dependency>
    <groupId>fr.jamailun.paper</groupId>
    <artifactId>ultimate-spell-system-api</artifactId>
    <version>2.0.0</version>
</dependency> 

Check the latest version here.

Don't forgot to add a dependency in your plugin.yml, so that the dependency will be loaded before your plugin.

Java entry-point

Then, inside your code, you can use the UltimateSpellSystem entry-point.

import org.bukkit.plugin.java.JavaPlugin;
import fr.jamailun.ultimatespellsystem.api.UltimateSpellSystem;

public class ExamplePlugin extends JavaPlugin {
    @Override
    public void onEnable() {
        boolean ussOk = UltimateSpellSystem.isValid();
        // Get the item-binder, the spells-manager, ...
    }
}

Please, not that using USS in the onLoad() phase way throw NPE. Wait for the onEnable().

How-to: Listen to events

To listen to an event, simply proceed with a class Listener & @EventHandler.

Events list

Here's a list of events you can listen to :

  • BoundSpellCastEvent : called when a Spell is cast from a bound ItemStack. Maybe Cancellable.
  • EntityCastEvent : called when a Spell is cast by an Entity. Cancellable.
  • EntitySummonedEvent : called when a Spell summons a SpellEntity.
  • ItemBoundEvent : called when a Spell is bound to an ItemStack.
  • ItemBoundEvent : called when a Spell is unbound from an ItemStack.

Clone this wiki locally