Match

public abstract class Match

Base class for every match. The lifecycle lives here; subclasses add game logic through the protected hooks. Call open once the subclass is fully constructed.

Constructors

Link copied to clipboard
protected void Match(MatchSettings settings)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
public final UUID runtimeId
Link copied to clipboard
public final MatchSettings settings
Link copied to clipboard
public final Set<UUID> startingRoster

Functions

Link copied to clipboard
protected void abortAdmission()
Releases a reservation when admission could not finish.
Link copied to clipboard
protected boolean acceptsPlayers()
Whether the match takes players right now, on top of the core's own checks.
Link copied to clipboard
protected boolean acceptsSpectator(Player player)
Whether an outsider may join as a spectator.
Link copied to clipboard
public final AdmissionResult admit(Collection<? extends Player> players)
Admits the players together or not at all.
public final AdmissionResult admit(Collection<? extends Player> players, BooleanSupplier stillAuthorized)
As admit, rechecking stillAuthorized around the cancellable callbacks so an external reservation, such as a party ready check, can withdraw admission.
Link copied to clipboard
public final AdmissionResult admitSpectator(Player player)
Admits an outsider as a spectator at the start location, in spectator mode.
Link copied to clipboard
public final boolean contains(Location location)
Link copied to clipboard
protected MatchPlayer createPlayer(Player player)
Link copied to clipboard
public final void destroy()
Removes every participant and tears the space down.
Link copied to clipboard
public final void destroyForShutdown()
Destroys the match because its plugin or the server is stopping.
Link copied to clipboard
public final void end(MatchOutcome outcome)
Ends the match once.
Link copied to clipboard
protected Location entryDestination(MatchPlayer player)
Link copied to clipboard
protected Location exitDestination(MatchPlayer player)
Settings exit, else where the player came from, else the main world spawn.
Link copied to clipboard
public final List<MatchPlayer> getActivePlayers()
Link copied to clipboard
public final MatchPlayer getMatchPlayer(Player player)
This match's participant for the player, or null.
Link copied to clipboard
public final List<MatchPlayer> getMatchPlayers()
Link copied to clipboard
public final MatchOutcome getOutcome()
Link copied to clipboard
public final MatchPhase getPhase()
Link copied to clipboard
public UUID getRuntimeId()
Link copied to clipboard
public final MatchSettings getSettings()
Link copied to clipboard
public final Set<UUID> getStartingRoster()
The active players when the match went ongoing.
Link copied to clipboard
protected final void handleDeath(Player player)
Treats the player as killed: the same handling lethal damage gets.
Link copied to clipboard
protected boolean hasJoinPermission(Player player)
Whether this player may join past requiredPermission; hosts can add their own exemptions.
Link copied to clipboard
protected Location intruderDestination(Player player)
Where non-participants found inside a running match are sent.
Link copied to clipboard
public final boolean isDestroyed()
Link copied to clipboard
public final boolean isOpen()
Link copied to clipboard
public final boolean leave(Player player, LeaveReason reason)
Removes a participant.
Link copied to clipboard
public final boolean moveParticipant(Player player, Location destination)
Moves one of this match's players anywhere inside its space, across its worlds.
Link copied to clipboard
protected void onAdmissionRolledBack(MatchPlayer player)
Admission failed after this player was created; undo anything createPlayer recorded.
Link copied to clipboard
protected void onDeath(MatchPlayer player)
Link copied to clipboard
protected void onDestroy()
Runs once, after every participant has left and before the space is torn down, so what the plugin placed inside temporary worlds can still be removed from them.
Link copied to clipboard
protected void onEnd(MatchOutcome outcome)
Link copied to clipboard
protected void onJoin(MatchPlayer player)
Link copied to clipboard
protected void onLeave(MatchPlayer player, LeaveReason reason)
Runs while the player is still a participant and the match state is intact.
Link copied to clipboard
protected void onReset()
A reusable match finished a run and is waiting again.
Link copied to clipboard
protected void onRevive(MatchPlayer player)
A spectating player was revived and is active again.
Link copied to clipboard
protected void onSpectating(MatchPlayer player)
The death policy turned an active player into a spectator.
Link copied to clipboard
protected void onStart()
Link copied to clipboard
public final boolean open()
Registers the match after asking the plugin API.
Link copied to clipboard
protected final boolean releaseReviveBanner(Player dead, boolean revive)
Clears the dead player's revive banner, reviving them when revive is true.
Link copied to clipboard
protected void requestEnd(MatchOutcome outcome)
Every ending the core decides on its own goes through here: defeat when the last active player leaves or dies, a neutral end when a countdown loses its minimum.
Link copied to clipboard
protected String requiredPermission()
The permission players need to join; spectators do not need it.
Link copied to clipboard
protected boolean reserveAdmission()
Taken after every admission check passes, before anyone is registered.
Link copied to clipboard
public final void retire()
Destroys the match for good, reusable or not.
Link copied to clipboard
protected final void scheduleDestroy(long ticks)
Destroys the match after ticks, replacing any destroy already scheduled.
Link copied to clipboard
protected Location spectatorDestination(MatchPlayer player)
Where an outsider who joins as a spectator is placed.
Link copied to clipboard
public final StartResult start()
Starts the countdown, or the match itself when the countdown is zero.
Link copied to clipboard
protected Location startDestination()
Where players go when the match starts, and the rescue point of last resort.