Skip to content
ProTerUga edited this page Jul 16, 2026 · 7 revisions

API Usage

Adding the dependency (via JitPack)

Maven

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>

<dependency>
    <groupId>com.github.ProTerUga</groupId>
    <artifactId>DonationAlertsAPI</artifactId>
    <version>VERSION</version>
    <scope>provided</scope>
</dependency>

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    compileOnly 'com.github.ProTerUga:DonationAlertsAPI:1.0.0'
}

Listening to DonationEvent

public class MyDonationListener implements Listener {
    
    @EventHandler
    public void onDonation(DonationEvent event) {
        String sender = event.getUsername();
        double amount = event.getAmount();
        String currency = event.getCurrency();
        String message = event.getMessage();
        
        Bukkit.broadcastMessage("§a" + sender + " donated " + amount + " " + currency + "!");
        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "give " + sender + " diamond 1");
    }
}

Register your listener

Bukkit.getPluginManager().registerEvents(new MyDonationListener(), this);

Depend on DonationAlertsAPI in plugin.yml

depend: [DonationAlertsAPI]
# or
softdepend: [DonationAlertsAPI]

Clone this wiki locally