Skip to content

Developer API

DreamDevs edited this page Jan 21, 2024 · 12 revisions

Since Version 1.6.0 there are tremendously changes in RandomLootChest API. A lot has changed since first events, objects, etc.

This feature is in beta and it may contains some bugs or something, just keep in mind! Thanks and have fun!


There are few events in RandomLootChest, some of them are more useful than others, but sometimes they can help a lot.

  • ChestAddEvent: This event fires when someone adds chest anywhere on the map using Chests Wand.
  • ChestRemoveEvent: This event fires when someone removes chest anywhere on the map using Chests Wand.
  • CombatEndPlayerEvent: This event fires when combat has ended for player
  • CombatStartPlayerEvent: This event fires when combat has started for player
  • CooldownExpiredEvent: This event fires when cooldown on specific chest has expired for player
  • CooldownSetEvent: This event fires when cooldown on chest has been set
  • ExtensionDisableEvent: This event fires when any extension has been disabled
  • ExtensionEnableEvent: This event fires when any extension has been enabled
  • PlayerInteractChestEvent: This event fires when player interacts with chest from this plugin

This is new way of adding features to RandomLootChest. All of the things that are not supposed to be in RandomLootChest, will be published as an addon/extension! Of course, the community also can create new features by creating extensions to this plugin!

How to create an Extension?

It's useful for those, who wants more than plugin offers itself. If you want to create for yourself or for RandomLootChest community, it's pretty simple! But first you need is that to add RandomLootChest dependency.

<repositories>
  <repository>
    <id>rlc-repo</id>
    <url>https://jitpack.io/</url>
  </repository>
</repositories>

<dependencies>
  <dependency>
    <groupId>com.github.MrABCDevelopment</groupId>
    <artifactId>RandomLootChest</artifactId>
    <version>v1.8.4.1</version>
    <scope>provided</scope>
  </dependency>
</dependencies>

Let's get into it! There are few requirements if you want your extension to work:

  • Main class of your Extension project
  • extension.yml have 5 attributes (3 of them are required to work)

So, first we need to know is how to fill extension.yml file. Let's start with all things that we can put into this file:

  • name - it's an Extension name
  • main - this is really important one, here you put path to your class, like: me.dreamdevs.github.randomlootchest.RandomLootChestMain
  • version - it's version of your project
  • author - it's an optional one, but you can put your name here
  • icon - it's an optional one; here you put material that will show in extension menu
    Let's start with some coding...
    package example.ExampleMain;
    
    public class ExampleMain extends Extension {
    
        @Override
        public void onExtensionEnable() {
            // Do something on extension enable
        }
    
        @Override
        public void onExtensionDisable() {
            // Do something on extension disable
        }
    
    }
    

    Is there any published API?

    Unfortunately, there's not yet published API on any website, but you can find classes to use in your project right here: api package

    Will I get any support, if I publish my extension project?

    Of course you will get any support, even if you don't publish your extension project.

Clone this wiki locally