DEVELOPER ๐ŸŒ API

๐Ÿ“ก Events

On this page, you will find every event the Phoenix Duels API fires.

#Events

Every event below lives under com.phoenixplugins.phoenixduels.api.events and is listened to like any other Bukkit event. See Examples for working listeners.

triangle-exclamation

The API is only available for the premium version of the plugin.

#Match Lifecycle

These fire in the order they are listed. Every one of them extends MatchEvent and exposes getMatch().

Event Cancellable Fired when
MatchCreateEvent Yes A match object has been built but no players have been moved yet. Cancelling stops the match from ever running.
MatchPreStartEvent Yes Just before players are teleported in, while every start requirement is being checked. See the note below on cancelling with a reason.
MatchStartEvent Yes The match is about to begin.
MatchPhaseStartEvent No The match moves from one state to another. Exposes getOldState() and getNewState().
MatchPreEndEvent No The match has been decided but has not been cleaned up yet, so match data is still readable.
MatchEndEvent No The match is over. getConnectedPlayers() returns everyone still online at that point.

MatchPhaseStartEvent reports one of six states: NOT_STARTED, ROUND_START, ROUND_IN_PROGRESS, POST_ROUND, ROUND_END and FINISHED.

circle-info

MatchPreStartEvent also has setCancelledReason(String). Using it instead of setCancelled(true) cancels the match and shows your own message to the players, which is how the CombatLogX hook explains that someone is in combat.

#Players in a Match

These extend MatchPlayerEvent, so they expose both getMatch() and getPlayer(). None of them are cancellable.

Event Fired when
MatchPlayerKillEvent A player kills someone. getVictim() returns who died.
MatchPlayerDeathEvent A player dies. getKiller() may be null. setDeathMessage(String[]) replaces the broadcast with your own text.
MatchPlayerLeaveEvent A player leaves the match. isGuest() tells you whether they were a spectator rather than a participant.
MatchSpectatorJoinEvent Someone starts spectating the match.
MatchSpectatorLeaveEvent Someone stops spectating the match.

#Elo

Event Fired when
MatchPlayerChangeEloEvent A match changes a player's rating in one mode. Exposes getPlayer(), getOldElo(), getNewElo() and getMatch().
PlayerGlobalEloChangeEvent A player's global elo changes, including through the admin commands. Exposes getPlayer(), getOldElo() and getNewElo().

Both give you an OfflinePlayer, because a rating can change while the player is not connected.

#Queue

Event Fired when
ProfileQueueStartEvent A player or party enters the matchmaking queue.
ProfileQueueStopEvent A player or party leaves it, whether by finding a match or by cancelling.

Both expose getProfile() for what was queued for, and getParticipants() for who queued. Neither is cancellable.

#Party

These extend PartyEvent and expose getParty(). None of them are cancellable.

Event Fired when
PartyCreatedEvent A party is created.
PartyDisbandEvent A party is disbanded. Carries the list of participants it had.
PartyParticipantAddedEvent A participant joins the party. Exposes getParticipant().
PartyParticipantAcceptedEvent A participant accepts their invitation. Exposes getParticipant().
PartyParticipantRemovedEvent A participant leaves or is kicked. Exposes getParticipant().
PartyLeaderChangedEvent Leadership passes to someone else. Exposes getOldLeaderUniqueId() and getNewLeaderUniqueId().

#Add-ons

Event Fired when
RematchWindowEvent A rematch window opens for a player at the end of a match. Exposes getPlayer() and getDurationSeconds(). Requires the Rematch & Requeue add-on.

#Cancellable events

Only three events can be cancelled, and all three cancel a match before it runs: MatchCreateEvent, MatchPreStartEvent and MatchStartEvent.

There is deliberately no way to cancel a kill, a death, or a player leaving. If you need to stop something during a fight, write a custom rule instead.

Last updated about 2 hours ago
My Cart (0 items)

Oops... looks like the spiders padded through here

Add products to your cart and remove them from here Lets buy