Quick Start

This page are going to teach you how to create your first plugin via ELD.

Before the continue reading, make sure you have understanding with these keywords:

  • Configuration - Mostly mean to YAML

  • Arguments - Mostly mean to command arguments

  • Service - Mostly mean to interface, and also API

  • Singleton - An Instance which keep only single one. If it's use in implementing interface, commonly will not be inject.

If you are using maven, you can follow the xml instruction as below.

<repositories>
    <repository>
        <id>nexus</id>
        <url>https://nexus.chu77.xyz/repository/plugins/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>org.eldependenci</groupId>
        <artifactId>eldependenci-framework</artifactId>
        <version>{最新版本}</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

At first you need to create two classes, the first is a registry class which for registering commands and listeners.

The second if a lifecycle class which to replcae the feature of JavaPlugin (to injectable lifecycle instance)

Start to create your main class.

Command Creation

Below examples showing how to create sub commands

Finally, define the parent-child relationship from registry class.

Event Listener (ELD ver)

You can instantly register bukkit listener into your registry class, but you can also register an eld listener which shows like below.

Finally register in registry class

Yaml Configuration

This framework are using ORM as configuration based. If you have the yaml below

The mapping object should set like this.

This framework are using jackson-databind-yaml as based,so you can use any jackson-annotations to control your mapper object.

Finally add your mapping object class in main.

Instance injection

Injecting yaml mapping object

example from sub commands

example from listeners

Injecting your own singleton

register singleton

example from lifecycle

@Inject can also use in constructor.

Injecting Service

Services and Singleton are different that services are using interface while singleton are using instance. Using interface can avoid the high coupling problem and commonly use for API, or with different implementations.

最后更新于