-
Notifications
You must be signed in to change notification settings - Fork 0
API: usage
This plugin has been made with extensibility in mind. You'll find a large panel of customizable elements.
Using maven, add the following dependency and repository in your pom.xml :
<repositories>
<!-- Your other repositories... -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<!-- Your other dependencies ... -->
<dependency>
<groupId>com.github.jamailun.UltimateSpellSystem</groupId>
<artifactId>ultimate-spell-system-api</artifactId>
<version>2.5.1</version>
</dependency>
</dependencies>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.
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, ...
}
}Warning
Using USS in the onLoad() phase may throw NPE. Wait for the onEnable().
After the first startup, you'll find the folder /plugins/UltimateSpellsSystem/spells. You can drop any file in it (.uss extension is optional). Every file will be loaded at startup, or you can do /uss reload to reload spells from the file-system.
For the syntax, you can learn more here.
If you need examples to get started, check the examples folder on git.
To listen to an event, simply proceed with a class Listener & @EventHandler.
Here's a list of events you can listen to :
-
BoundSpellCastEvent: called when aSpellis cast from a boundItemStack. Maybe Cancellable. -
EntityCastEvent: called when aSpellis cast by anEntity. Cancellable. -
EntitySummonedEvent: called when aSpellsummons aSpellEntity. -
ItemBoundEvent: called when aSpellis bound to anItemStack. -
ItemBoundEvent: called when aSpellis unbound from anItemStack.
Check the registries wiki page.