Interface RejoinService


public interface RejoinService
Corpse-backed rejoin: a player who left a running match can return to it through the corpse they left behind, with their inventory, experience, ender chest and team.

This is the same operation /rejoin performs, with the same rules from settings.yml rejoin-settings. A return can be refused before it commits by cancelling PlayerJoinGameEvent, whose isRejoin() is true for it; a committed one is reported by PlayerRejoinGameEvent, and the corpse is then removed with CorpseRemovalReason.REJOINED.

Since:
1.8.0
  • Method Summary

    Modifier and Type
    Method
    Description
    getReturnableCorpse(@NotNull UUID playerId)
    The corpse that holds a player's return, online or not.
    @NotNull RejoinStatus
    getStatus(@NotNull org.bukkit.entity.Player player)
    Whether a player can rejoin now.
    rejoin(@NotNull org.bukkit.entity.Player player)
    Returns a player to the match they left, exactly as /rejoin does - its messages to the player and the match included.
  • Method Details

    • getStatus

      @NotNull @NotNull RejoinStatus getStatus(@NotNull @NotNull org.bukkit.entity.Player player)
      Whether a player can rejoin now. Main thread only.
      Parameters:
      player - the player
      Returns:
      their status
    • getReturnableCorpse

      @NotNull @NotNull Optional<ZentrixCorpse> getReturnableCorpse(@NotNull @NotNull UUID playerId)
      The corpse that holds a player's return, online or not.
      Parameters:
      playerId - the player
      Returns:
      the corpse, or empty when they hold no return
    • rejoin

      @NotNull @NotNull CompletableFuture<RejoinEligibility> rejoin(@NotNull @NotNull org.bukkit.entity.Player player)
      Returns a player to the match they left, exactly as /rejoin does - its messages to the player and the match included. Main thread only.

      The corpse's chunk may have to be loaded first, so the future can complete a few ticks later, on the main thread. It always completes: with RejoinEligibility.ELIGIBLE once the player is back, otherwise with why they are not. A failed return changes nothing, and the corpse stays for another attempt.

      Parameters:
      player - the returning player
      Returns:
      the outcome