Promotion background
Halloween Season IS HERE!
10% off limited time offer!
limited time offer SAVE 10% NOW →

Build your own Phoenix Duels add-on

Premium API

Write Java add-ons that react to matches, kills, deaths, queues, parties and elo changes, or stop a match before it starts. The API is only available in Phoenix Duels Premium.

Setup

Maven, exactly as documented on API:

XML
<repositories>
    <repository>
        <id>phoenixplugins</id>
        <url>https://repo.phoenixplugins.com/</url>
    </repository>
</repositories>
XML
<dependency>
    <groupId>com.phoenixplugins.phoenixduels</groupId>
    <artifactId>api</artifactId>
    <version>1.0.0-SNAPSHOT</version>
</dependency>

Gradle

The docs only show Maven snippets; no Gradle snippet is documented yet. Dependency details: see API.

Add-on structure

addon.yml

Create an addon.yml file in your project resources folder.

YAML
name: AddonName
main: your.path.AddonExample
author: [YourName]
version: 1.0.0
description: Small description (optional)
website: https://your-website.com (optional)

Required fields:

  • name: Display name of your addon.
  • main: Fully qualified path to your addon main class.
  • author: One or more addon authors.
  • version: Addon version.

Main Class Example

The main value in addon.yml must point to your class that extends Addon.

JAVA
package your.path;

import com.phoenixplugins.phoenixduels.api.sdk.plugin.addons.Addon;

public class AddonExample extends Addon {

    @Override
    public void init() {
        // Register rules, menus, modules, or listeners.
    }

    @Override
    public void load() {
        // Runtime registrations and startup logic.
    }

    @Override
    public void unload() {
        // Cleanup logic.
    }

    @Override
    public void reload() {
        // Optional runtime reload logic.
    }

    @Override
    public String getRequiredPluginVersion() {
        return "1.0.0";
    }
}

Build and Install

  1. Build your addon JAR with your normal project build command.
  2. Move the compiled JAR into plugins/PhoenixDuels/addons.
  3. Restart the server.
  4. Check console logs to confirm the addon was loaded successfully.

Source: Custom Addons.

Events

22 documented events, from Events. All are Bukkit events, listened to with @EventHandler.

EventFires whenCancellableReference
MatchCreateEvent A match object has been built but no players have been moved yet. Cancelling stops the match from ever running. Yes Docs · Javadoc
MatchPreStartEvent Just before players are teleported in, while every start requirement is being checked. See the note below on cancelling with a reason. Yes Docs · Javadoc
MatchStartEvent The match is about to begin. Yes Docs · Javadoc
MatchPhaseStartEvent The match moves from one state to another. Exposes getOldState() and getNewState(). No Docs · Javadoc
MatchPreEndEvent The match has been decided but has not been cleaned up yet, so match data is still readable. No Docs · Javadoc
MatchEndEvent The match is over. getConnectedPlayers() returns everyone still online at that point. No Docs · Javadoc
MatchPlayerKillEvent A player kills someone. getVictim() returns who died. No Docs · Javadoc
MatchPlayerDeathEvent A player dies. getKiller() may be null. setDeathMessage(String[]) replaces the broadcast with your own text. No Docs · Javadoc
MatchPlayerLeaveEvent A player leaves the match. isGuest() tells you whether they were a spectator rather than a participant. No Docs · Javadoc
MatchSpectatorJoinEvent Someone starts spectating the match. No Docs · Javadoc
MatchSpectatorLeaveEvent Someone stops spectating the match. No Docs · Javadoc
MatchPlayerChangeEloEvent A match changes a player's rating in one mode. Exposes getPlayer(), getOldElo(), getNewElo() and getMatch(). No Docs · Javadoc
PlayerGlobalEloChangeEvent A player's global elo changes, including through the admin commands. Exposes getPlayer(), getOldElo() and getNewElo(). No Docs · Javadoc
ProfileQueueStartEvent A player or party enters the matchmaking queue. No Docs · Javadoc
ProfileQueueStopEvent A player or party leaves it, whether by finding a match or by cancelling. No Docs · Javadoc
PartyCreatedEvent A party is created. No Docs · Javadoc
PartyDisbandEvent A party is disbanded. Carries the list of participants it had. No Docs · Javadoc
PartyParticipantAddedEvent A participant joins the party. Exposes getParticipant(). No Docs · Javadoc
PartyParticipantAcceptedEvent A participant accepts their invitation. Exposes getParticipant(). No Docs · Javadoc
PartyParticipantRemovedEvent A participant leaves or is kicked. Exposes getParticipant(). No Docs · Javadoc
PartyLeaderChangedEvent Leadership passes to someone else. Exposes getOldLeaderUniqueId() and getNewLeaderUniqueId(). No Docs · Javadoc
RematchWindowEvent A rematch window opens for a player at the end of a match. Exposes getPlayer() and getDurationSeconds(). Requires the Rematch & Requeue add-on. No Docs · Javadoc

Also in the javadoc, not yet described in the docs: MatchProfileEvent.

Complete example

Track match start and phase transitions, verbatim from Examples:

JAVA
import com.phoenixplugins.phoenixduels.api.events.MatchPhaseStartEvent;
import com.phoenixplugins.phoenixduels.api.events.MatchStartEvent;
import com.phoenixplugins.phoenixduels.api.match.MatchState;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;

public final class MatchLifecycleListener implements Listener {

    @EventHandler
    public void onStart(MatchStartEvent event) {
        if (event.getMatch().getTeamsPlayers().isEmpty()) {
            event.setCancelled(true);
        }
    }

    @EventHandler
    public void onPhase(MatchPhaseStartEvent event) {
        if (event.getNewState() == MatchState.ROUND_IN_PROGRESS) {
            // Start your per-round metrics.
        }
    }
}

Registering a listener

Register your listener through plugin entrypoint, from Examples:

JAVA
import com.phoenixplugins.phoenixduels.api.PhoenixDuelsAPI;
import org.bukkit.event.Listener;

public final class ListenerBootstrap {

    public void register(Listener listener) {
        PhoenixDuelsAPI.getPluginInstance().getEventBus().registerListener(listener);
    }
}

More examples: Examples.

Configuration

Plain-text docs

For offline reading, scripts and tools, all Phoenix Duels docs are available as one text file. Any docs page can be read as plain markdown by adding .md to its URL.

My Cart
Spider

Your cart is empty

Looks like the spiders padded through here. Pick a plugin and it will show up here. Continue shopping