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

Build your own Phoenix Lobby add-on

Premium API

Hook your own plugin into Phoenix Lobby: listen to double jump and parkour events, and read NPCs, lobby worlds, PvP mode and parkour scores through PhoenixLobbyAPI. The API is only available in Phoenix Lobby 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.phoenixlobby</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

The Lobby docs don't describe an add-on loader. They show a regular plugin that declares PhoenixLobby as a dependency and calls PhoenixLobbyAPI.

Getting started

Add PhoenixLobby to your plugin.yml so your plugin loads after it.

YAML
depend: [PhoenixLobby]

Use softdepend instead if your plugin should still work when PhoenixLobby is not installed. In that case check PhoenixLobbyAPI.isAvailable() before calling anything.

The API class

PhoenixLobbyAPI answers questions about the lobby without going through placeholders.

JAVA
if (!PhoenixLobbyAPI.isAvailable()) {
    return;
}

PhoenixLobbyAPI api = PhoenixLobbyAPI.get();
Method Returns
getVersion() The version of PhoenixLobby that is running
getNpcTypes() Every NPC configured on this server
getNpcType(String identifier) One NPC by its identifier, as an Optional
isLobbyWorld(String worldName) Whether the plugin treats that world as a lobby
isInPvpMode(Player player) Whether the player is in PvP mode
getPlayingParkour(Player player) The parkour the player is running, as an Optional
getParkourHighScore(Player, String) That player's best score on a parkour
JAVA
PhoenixLobbyAPI.get().getPlayingParkour(player).ifPresent(parkour -> {
    player.sendMessage("You are running " + parkour + ".");
});

An NpcType gives you isEnabled(), getIdentifier(), getDisplayName() and getEngineData(), which in turn reports the engine that NPC is drawn with. PhoenixLobbyAPI.get() throws if the plugin has not finished loading. Call it from inside your own onEnable or later, never from a static initialiser, and guard it with isAvailable() when PhoenixLobby is only a soft dependency.

Source: API.

Events

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

EventFires whenCancellableReference
PlayerDoubleJumpEvent A player uses the double jump Yes Docs · Javadoc
PlayerParkourStartEvent A player starts a parkour run Yes Docs · Javadoc
PlayerParkourJumpEvent A player lands on the next parkour block No Docs · Javadoc
PlayerParkourEndEvent A parkour run ends No Docs · Javadoc

Complete example

Parkour record listener, verbatim from Events:

JAVA
public class ParkourListener implements Listener {

    @EventHandler
    public void onParkourEnd(PlayerParkourEndEvent event) {
        if (!event.isNewRecord()) {
            return;
        }

        Bukkit.broadcastMessage(event.getPlayer().getName()
                + " set a new record on " + event.getParkourIdentifier()
                + " with " + event.getScore() + " points.");
    }
}

Registering a listener

The docs don't show listener registration inside an add-on yet.

Configuration

Plain-text docs

For offline reading, scripts and tools, all Phoenix Lobby 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