Class EliminationOptions

java.lang.Object
dev.itsharshxd.zentrix.api.elimination.EliminationOptions

public final class EliminationOptions extends Object
What an elimination should and should not do besides removing the player from the match.

Zentrix's ordinary death pipeline pays out kills, currency, first blood and statistics because a player earned them. An elimination that comes from a rule rather than from a fight normally should not, which is exactly what these switches are for: scenario() starts from "nobody earned anything" and lets you turn back on only what your rule really awards.

The parts that keep the match consistent — removing the player from their team, converting them to a spectator, marking a team eliminated, firing the addon events, checking the win condition — are not optional and always happen.

Example


 // An objective win: the losing teams are out, but nobody gets kill credit for it.
 EliminationOptions options = EliminationOptions.scenario()
         .announce(true)
         .messageKey("scenarios.dragon-rush.eliminated")
         .build();
 
Since:
1.6.0
  • Method Details

    • scenario

      @NotNull public static @NotNull EliminationOptions.Builder scenario()
      The preset for a rule-driven elimination: no kill credit, no kill reward, no first blood, no corpse and no revival record, but statistics, announcement and the win-condition check intact.
    • administrative

      @NotNull public static @NotNull EliminationOptions.Builder administrative()
      The preset for an administrative removal: nothing is awarded and nothing is announced.
    • builder

      @NotNull public static @NotNull EliminationOptions.Builder builder()
    • cause

      @NotNull public @NotNull EliminationCause cause()
    • attacker

      @NotNull public Optional<UUID> attacker()
      The player credited with causing this, when the caller wants one recorded.
    • awardKillCredit

      public boolean awardKillCredit()
      Whether the attacker's kill counter goes up.
    • awardCurrency

      public boolean awardCurrency()
      Whether kill and death currency rewards are paid out.
    • awardFirstBlood

      public boolean awardFirstBlood()
      Whether this elimination may claim the match's first-blood reward.
    • recordStatistics

      public boolean recordStatistics()
      Whether the death is written to the eliminated player's persistent profile.
    • spawnCorpse

      public boolean spawnCorpse()
      Whether a lootable corpse is left behind.
    • recordForRevival

      public boolean recordForRevival()
      Whether teammates may revive the eliminated player afterwards.
    • dropInventory

      public boolean dropInventory()
      Whether the eliminated player's inventory is dropped where they stood.
    • announce

      public boolean announce()
      Whether the match is told somebody was eliminated.
    • messageKey

      @NotNull public Optional<String> messageKey()
      The locale key of the announcement, which receives a {victim} placeholder.

      Empty falls back to Zentrix's ordinary elimination message.

    • checkWinCondition

      public boolean checkWinCondition()
      Whether the win condition is checked once the whole request is done.

      This is the only win-condition check an elimination makes. Removing a player does not run one of its own, so a batch that eliminates the second-to-last team ends the match here, once, after every player and team in the request has been through the pipeline — which is what keeps the elimination announcements ahead of the winner announcement.

      Turning it off means no synchronous check at all. The match will still end, because the playing state re-checks the win condition every second, but it ends on that tick rather than inside the call, and the eliminated player is no longer identified to it — the final defeat goes unrecorded. Switch it off only when the caller runs its own check straight afterwards, for instance because it is still mutating the match. Defaults to true.