Skip to content

EldoPlugin

Florian Fülling edited this page Jun 3, 2021 · 1 revision

The EldoPlugin provides a basic implementation of a JavaPlugin with some additional stuff like shortcuts.

Instance

The EldoPlugin provides the plugin instance via a classic EldoPlugin#getInstance().

However calling this should be avoided whenever possible. Retrieving the instance like this is usually a sign of bad software design.

Logging

Since logging is always important and you should use the plugin logger, the logger is provided via the EldoPlugin#logger(Class<? extend EldoPlugin>) method.

Use this instance whenever possible.
Since all Plugins implementing the eldo plugin class the logger cant be provided via a 0 args method.

Because of this it is advisable to create an own method called EldoPlugin#logger() which simply delegates to the underlying method.

This method is just provided for completeness.

Command registration

EldoPlugin forces you to implement the TabExecutor interface. This is done to force quality in our plugins. We always want to provide tab completion. Therefore we don't care about the CommandExecutor.

To register a command you can call the EldoPlugin#registerCommand(String, TabExecutor) method.
This method will try to register your command when the command could be found or will print a warning of the entered command is not present.

Listener Registration

You can register one or more listeners via the EldoPlugin#registerListener(Listener...) method.
The usage should be self explanatory.

Scheduling

Since a lot of plugins use scheduler and some core schedulers are often initialized on plugin startup we provide a method for this as well.
Registering a new scheduler can be done by calling EldoPlugin#scheduleRepeatingTask(Runnable, int) for fixed initial delay of 5 seconds or 100 Ticks or by callind EldoPlugin#scheduleRepeatingTask(Runnable, int, int) to define your own delay.

Clone this wiki locally