Interface DuelAPI
public interface DuelAPI
-
Method Summary
Modifier and TypeMethodDescriptionvoidend(@NotNull org.bukkit.event.entity.PlayerDeathEvent event) Ends the duel after one player has been defeated.voidendRound(@NotNull org.bukkit.event.entity.PlayerDeathEvent event) Ends the current round of the duel and proceeds to the next round, or ends the duel if no rounds remain.voidForces the closing of all ongoing duels.@NotNull @UnmodifiableView Map<UUID, DuelSession> Gets all active duel sessions.booleaninDuel(@NotNull org.bukkit.entity.Player player) Checks if a player is currently in a duel.booleanisSpectating(@NotNull org.bukkit.entity.Player player) Checks if a player is currently spectating a duel.voidleave(@NotNull org.bukkit.entity.Player player) Allows a player to leave the duel, either by quitting or being forcibly removed.voidleaveSpectating(@NotNull org.bukkit.entity.Player spectator, boolean messages) Allows a spectator to leave the duel they are spectating.voidremove(@NotNull org.bukkit.entity.Player player) Removes a player from all duel-related data, including their session, teams, and other information.voidspectate(@NotNull org.bukkit.entity.Player spectator, @NotNull org.bukkit.entity.Player player) Allows a player to spectate an ongoing duel.voidstart(@NotNull org.bukkit.entity.Player player1, @NotNull org.bukkit.entity.Player player2, String kit, int rounds) Starts a duel between two players with a specific kit and number of rounds.voidstart(@NotNull org.bukkit.entity.Player player1, @NotNull org.bukkit.entity.Player player2, String kit, int rounds, String display) Starts a duel between two players with a specific kit, number of rounds, and arena display name.
-
Method Details
-
start
void start(@NotNull @NotNull org.bukkit.entity.Player player1, @NotNull @NotNull org.bukkit.entity.Player player2, String kit, int rounds) Starts a duel between two players with a specific kit and number of rounds. The duel is set as a best-of-x format.- Parameters:
player1- The first player in the duel.player2- The second player in the duel.kit- The name of the kit to be used in the duel.rounds- The number of rounds in the duel (first of x).
-
start
void start(@NotNull @NotNull org.bukkit.entity.Player player1, @NotNull @NotNull org.bukkit.entity.Player player2, String kit, int rounds, String display) Starts a duel between two players with a specific kit, number of rounds, and arena display name. The duel is set as a best-of-x format, and the display name is used to find the corresponding arena.- Parameters:
player1- The first player in the duel.player2- The second player in the duel.kit- The name of the kit to be used in the duel.rounds- The number of rounds in the duel (first of x).display- The display name of the arena to use.
-
endRound
void endRound(@NotNull @NotNull org.bukkit.event.entity.PlayerDeathEvent event) Ends the current round of the duel and proceeds to the next round, or ends the duel if no rounds remain.- Parameters:
event- ThePlayerDeathEventthat ends the round.
-
end
void end(@NotNull @NotNull org.bukkit.event.entity.PlayerDeathEvent event) Ends the duel after one player has been defeated.- Parameters:
event- ThePlayerDeathEventthat ends the duel.
-
leave
void leave(@NotNull @NotNull org.bukkit.entity.Player player) Allows a player to leave the duel, either by quitting or being forcibly removed.- Parameters:
player- The player who is leaving the duel.
-
forceClose
void forceClose()Forces the closing of all ongoing duels. -
spectate
void spectate(@NotNull @NotNull org.bukkit.entity.Player spectator, @NotNull @NotNull org.bukkit.entity.Player player) Allows a player to spectate an ongoing duel.- Parameters:
spectator- The player who wants to spectate.player- The player involved in the duel that the spectator wants to watch.
-
leaveSpectating
void leaveSpectating(@NotNull @NotNull org.bukkit.entity.Player spectator, boolean messages) Allows a spectator to leave the duel they are spectating.- Parameters:
spectator- The spectator who is leaving.messages- Whether or not to send messages to the spectator when they leave.
-
inDuel
boolean inDuel(@NotNull @NotNull org.bukkit.entity.Player player) Checks if a player is currently in a duel.- Parameters:
player- The player to check.- Returns:
trueif the player is in a duel,falseotherwise.
-
isSpectating
boolean isSpectating(@NotNull @NotNull org.bukkit.entity.Player player) Checks if a player is currently spectating a duel.- Parameters:
player- The player to check.- Returns:
trueif the player is spectating,falseotherwise.
-
remove
void remove(@NotNull @NotNull org.bukkit.entity.Player player) Removes a player from all duel-related data, including their session, teams, and other information.- Parameters:
player- The player to remove from the duel.
-
getActiveDuels
Gets all active duel sessions.- Returns:
- A map of active duel sessions with player UUIDs as keys and duel session objects as values.
-