Oops... looks like the spiders padded through here
Add products to your cart and remove them from here Lets buyOn this page, you will find the events and the API another plugin can use to build on top of PhoenixLobby.
Add PhoenixLobby to your plugin.yml so your plugin loads after it.
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.
Four events are fired, and all of them are ordinary Bukkit events, so a normal listener picks them up.
| Event | Fired when |
|---|---|
PlayerDoubleJumpEvent |
A player uses the double jump |
PlayerParkourStartEvent |
A player starts a parkour run |
PlayerParkourJumpEvent |
A player lands on the next parkour block |
PlayerParkourEndEvent |
A parkour run ends |
They all live in com.phoenixplugins.phoenixlobby.api.events.
| Event | Available on the event | Cancellable |
|---|---|---|
PlayerDoubleJumpEvent |
getPlayer() |
Yes |
PlayerParkourStartEvent |
getPlayer(), getParkourIdentifier()
|
Yes |
PlayerParkourJumpEvent |
getPlayer(), getParkourIdentifier(), getScore()
|
No |
PlayerParkourEndEvent |
getPlayer(), getParkourIdentifier(), getScore(), getElapsedSeconds(), isNewRecord()
|
No |
Cancelling PlayerDoubleJumpEvent stops the launch, and cancelling PlayerParkourStartEvent stops the run before it begins β which is how another plugin blocks either one in its own regions or during its own events.
@EventHandler
public void onDoubleJump(PlayerDoubleJumpEvent event) {
if (isInMyArena(event.getPlayer())) {
event.setCancelled(true);
}
}
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.");
}
}
The parkour identifier is the one you gave the parkour in the editor, the same string the parkour placeholders take.
PhoenixLobbyAPI answers questions about the lobby without going through placeholders.
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 |
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.
Anything not on this page is internal and can change between versions. For values rather than behaviour, the placeholders are the stable route and cover far more of the plugin than the API does.
Oops... looks like the spiders padded through here
Add products to your cart and remove them from here Lets buy