API Usage

API Usage

Register Your Plugin

In order to use the various services that Interactables has to offer, you must first register your plugin with the Interactables API.

1. Retrieve the global Interactables instance with:

Bukkit.getServer().getServicesManager().load(Interactables.class)

Make sure you have Interactables listed as a dependency in your plugin.yml or this may not work.

2. Register your plugin's main class with:

interactables.registerPlugin(InteractablesPlugin your_plugin);

The class you register must implement InteractablesPlugin.

Register Your Commands

If you want your commands to be available through the /interactable command as well as be seen on the /interactables help page, you must register them with Interactables' CommandHandler.

1. Retrieve the CommandHandler instance with:

interactables.getCommandHandler()

2. Register your command with:

commandHandler.registerCommand(CommandLabel your_command);

Your commands must be built with the CommandLabel class outlined by Interactables. (Make a class for each command extending CommandLabel)

Create Your Interactable Type

The key idea behind Interactables is to create objects in Minecraft that when interacted with, execute commands and or send messages. To get started with achieving this, you should use the Interactable interface.

1. Create your Interactable type by creating a class implementing Interactable.

2. Create fields for each of the required methods as well as your own fields that make up your Interactable type. More information can be found on the JavaDocs (See top)

3. When a new interactable is created through your plugin, however you may do it, register the Interactable with Interactables' InteractableManager. Do this with:

interactables.getInteractableManager().registerInteractable(Interactable your_interactable);

Don't forget that you must create your own means of detecting when an interactable should trigger. This may be a listener, command, or other way of triggering.

JavaDocs found here (<- Will add soon)


Comments

Posts Quoted:
Reply
Clear All Quotes