Skip to content
This repository was archived by the owner on May 3, 2025. It is now read-only.

Hooking into MoneyPitAPI

YouHaveTrouble edited this page Oct 14, 2023 · 2 revisions

Import MoneyPitAPI using your dependency manager

You should replace API-VERSION with latest version of the api available.

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.github.YouHaveTrouble</groupId>
        <artifactId>MoneyPitAPI</artifactId>
        <version>API-VERSION</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Gradle

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    implementation 'com.github.YouHaveTrouble:MoneyPitAPI:API-VERSION'
}

Add MoneyPit to your plugin depends

Bukkit plugin

softdepend:
  - MoneyPit

Paper plugin

dependencies:
  MoneyPit:
    load: AFTER
    required: false

Getting registered economy provider

@Override
public void onEnable() {
    RegisteredServiceProvider<Economy> provider = getServer().getServicesManager().getRegistration(Economy.class);

    if (provider == null) {
        // No plugins are registered as economy providers
        this.getServer().getPluginManager().disablePlugin(this);
        return; 
    }

    Economy economy = provider.getProvider(); // provided Economy class you can use
}