Skip to content

Development API

Terry edited this page Nov 11, 2024 · 8 revisions

Implementation

Using Maven

⚠️ Currently not available.

Using Gradle

⚠️ Currently not available.

Plugin Dependency

You need to add WizardAPI as dependency in your plugin.

plugin.yml

depend: [WizardAPI]

paper-plugin.yml

dependencies:
  server:
    WizardAPI:
      load: BEFORE
      required: true

Getting Started

// You need to specify a id (string) for every wand.    
Wand wand = new Wand("custom_wand", new ItemStack(Material.STICK)); // You can use any itemstack here

Spell spell = new Spell(player -> {

    // Spell Logic

}, Spell.ClickType.LEFT, Spell.ClickType.RIGHT, Spell.ClickType.RIGHT); // Combination: L-R-R

/*
 You can add up to multiple spells. But you have maximum of 8 since the combinations are limited.
 Possible Combinations: L-L-L, L-L-R, L-R-L, L-R-R, R-R-R, R-R-L, R-L-R, R-R-L 
*/
wand.bind(spell);

// You need to register wands into the API
WizardAPI.getInstance().register(wand);

Methods

WizardAPI api = WizardAPI.getInstance(); // Get instance

api.register(Wand wand); // Register wand
api.getWandById(String id); // Get Wand by ID
api.getWandByItem(ItemStack itemstack); // Get Wand by ItemStack
api.isWand(ItemStack itemstack); // Checks if a ItemStack is a Wand
api.getAllWands(); // Get all wands

Full Example

Clone this wiki locally