Klasse ArenaSession
java.lang.Object
de.delinkedde.mobarenareborn.session.ArenaSession
A single in-progress instance of an arena: its participants, lifecycle state and timers.
The session drives the lobby flow: players join into ArenaState.WAITING, ready up,
and once everyone is ready (and the minimum is met) a ArenaState.COUNTDOWN runs before
the round starts (ArenaState.RUNNING). Joining or losing readiness during the
countdown cancels it. The wave loop is layered onto the running state in a later milestone.
Timers use the Bukkit scheduler. On a regionised server (Folia) these would move to the region scheduler; that migration is deferred until threading is addressed.
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungstatic final StringMetadata key marking the invulnerability probe hit, so the lobby damage shield lets the probe through instead of masking god mode. -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungArenaSession(@NotNull MobArenaPlugin plugin, @NotNull Arena arena, @NotNull ConfigManager config, @NotNull Messages messages, @NotNull MobRegistry mobRegistry, @NotNull MobScaler mobScaler, @NotNull BossRegistry bossRegistry, @NotNull WaveSetRegistry waveSetRegistry, @NotNull ClassRegistry classRegistry, @NotNull ProgressionService progression, @NotNull RewardService rewardService, @NotNull RewardCache rewardCache, @NotNull StashStore stashStore, @NotNull StatsService statsService, @NotNull PetService petService) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungbooleanvoidAdds a player to the lobby, capturing and clearing their state.voidaddRoundKill(@NotNull Player player) voidBroadcasts a MiniMessage line (with the arena prefix) to everyone in this session.@NotNull Arenaarena()@Nullable StringchosenClass(@NotNull Player player) Returns the class a player has chosen in this session, if any.intcountChosen(@NotNull String className) Counts how many players have chosen the given class in this session.intvoidEliminates a player from the running round.voidend()Ends the round, restoring every remaining player.voidImmediately starts the round, skipping any remaining countdown.booleaninLobby()booleanisEmpty()booleanisPlacedBlock(Block block) booleanintbooleanRemoves a player and restores their captured state.booleanremoveQuietly(@NotNull Player player) Removes a disconnecting player without restoring their captured state.voidsetChosenClass(@NotNull Player player, @NotNull String className) Records a player's class choice.voidsetEndCallback(@NotNull Runnable endCallback) Registers a callback invoked when the session ends, regardless of which code path ended it.voidsetKickCallback(Consumer<Player> kickCallback) Registers a callback invoked when the session removes a player on its own initiative (for example a not-ready kick when the lobby countdown expires), so the session manager can drop its player-index entry.voidSets a player's ready flag and starts or cancels the countdown accordingly.intsize()@NotNull ArenaStatestate()voidtrackPlacedBlock(Block block) Tracks a block a fighter placed during the round (tactical building).voiduntrackPlacedBlock(Block block) Untracks a placed block (after it was broken or blown up).
-
Felddetails
-
DAMAGE_PROBE_METADATA
Metadata key marking the invulnerability probe hit, so the lobby damage shield lets the probe through instead of masking god mode.- Siehe auch:
-
-
Konstruktordetails
-
ArenaSession
public ArenaSession(@NotNull @NotNull MobArenaPlugin plugin, @NotNull @NotNull Arena arena, @NotNull @NotNull ConfigManager config, @NotNull @NotNull Messages messages, @NotNull @NotNull MobRegistry mobRegistry, @NotNull @NotNull MobScaler mobScaler, @NotNull @NotNull BossRegistry bossRegistry, @NotNull @NotNull WaveSetRegistry waveSetRegistry, @NotNull @NotNull ClassRegistry classRegistry, @NotNull @NotNull ProgressionService progression, @NotNull @NotNull RewardService rewardService, @NotNull @NotNull RewardCache rewardCache, @NotNull @NotNull StashStore stashStore, @NotNull @NotNull StatsService statsService, @NotNull @NotNull PetService petService) - Parameter:
plugin- the owning plugin, used for schedulingarena- the arena this session is runningconfig- the configuration manager, read for lobby thresholdsmessages- the message renderer for broadcastsmobRegistry- the mob registry used by the wave enginemobScaler- the mob scaler used by the wave enginebossRegistry- the boss registry used by the wave enginewaveSetRegistry- the wave-set registry used to resolve the arena's rosterclassRegistry- the class registry used to resolve loadoutsprogression- the progression service used for class levelsrewardService- the wave-reward service used for wave-completion rewardsrewardCache- the reward cache holding rewards that did not fit a full inventorystashStore- the persistent stash store guarding against crashes mid-roundstatsService- the statistics service recording rounds and best wavespetService- the pet service spawning and cleaning up companions
-
-
Methodendetails
-
arena
- Gibt zurück:
- the arena this session belongs to
-
setEndCallback
Registers a callback invoked when the session ends, regardless of which code path ended it. The session manager uses this to drop the session from its lookup maps, so an internally triggered end (for example a game over after the last elimination) never leaves stale index entries behind.- Parameter:
endCallback- the callback to run on end
-
setKickCallback
Registers a callback invoked when the session removes a player on its own initiative (for example a not-ready kick when the lobby countdown expires), so the session manager can drop its player-index entry.- Parameter:
kickCallback- the callback receiving the removed player
-
size
public int size()- Gibt zurück:
- the number of players in this session
-
notReadyNames
- Gibt zurück:
- the names of lobby players who have not readied up yet
-
participantNames
- Gibt zurück:
- the names of everyone currently in this session
-
readyPlayers
public int readyPlayers()- Gibt zurück:
- the number of players who have readied up
-
currentWave
public int currentWave()- Gibt zurück:
- the current wave number, or
0while no round is running
-
countChosen
Counts how many players have chosen the given class in this session.- Parameter:
className- the class identifier- Gibt zurück:
- the number of players with that class chosen
-
state
- Gibt zurück:
- the current lifecycle state
-
isEmpty
public boolean isEmpty()- Gibt zurück:
trueif no players remain in the session
-
playerIds
- Gibt zurück:
- an immutable copy of the participating player ids
-
acceptsJoins
public boolean acceptsJoins()- Gibt zurück:
trueif players may still join (the round has not started)
-
add
Adds a player to the lobby, capturing and clearing their state.- Parameter:
player- the joining player
-
remove
Removes a player and restores their captured state.- Parameter:
player- the leaving player- Gibt zurück:
trueif the player was part of this session
-
removeQuietly
Removes a disconnecting player without restoring their captured state. Their stash stays persisted instashes.yml(server-restart proof) and is applied on their next join: original position, original inventory. Rewards earned so far go into the reward cache and are delivered on rejoin.- Parameter:
player- the disconnecting player- Gibt zurück:
trueif the player was part of this session
-
eliminate
Eliminates a player from the running round. The player is healed, cleared of effects, dropped into spectator mode at the spectator warp and no longer counts as a live fighter. When no live players remain the round ends with a game-over message.- Parameter:
player- the player to eliminate
-
setReady
Sets a player's ready flag and starts or cancels the countdown accordingly.- Parameter:
player- the playerready- the new ready state
-
isReady
- Parameter:
player- the player- Gibt zurück:
- whether the player is currently flagged ready
-
inLobby
public boolean inLobby()- Gibt zurück:
trueif the session is in its lobby phase (waiting or counting down)
-
forceStart
public void forceStart()Immediately starts the round, skipping any remaining countdown. Has no effect once the round is already running or ended. -
end
public void end()Ends the round, restoring every remaining player. Idempotent. -
chosenClass
Returns the class a player has chosen in this session, if any.- Parameter:
player- the player- Gibt zurück:
- the chosen class identifier, or
null
-
setChosenClass
Records a player's class choice. Only meaningful before the round starts.- Parameter:
player- the playerclassName- the chosen class identifier
-
onlinePlayers
- Gibt zurück:
- the online players currently in this session
-
livingPlayers
- Gibt zurück:
- the online players still alive (not eliminated) in this session; these are the fighters the wave engine spawns for and mobs target
-
announce
Broadcasts a MiniMessage line (with the arena prefix) to everyone in this session. Public for collaborating systems such as the boss loot handler.- Parameter:
miniMessage- the message
-
trackPlacedBlock
Tracks a block a fighter placed during the round (tactical building). Tracked blocks may be broken again, pop in explosions, and are removed when the round ends.- Parameter:
block- the placed block
-
isPlacedBlock
- Parameter:
block- the block to test- Gibt zurück:
- whether the block was placed during this round
-
untrackPlacedBlock
Untracks a placed block (after it was broken or blown up).- Parameter:
block- the block
-
addRoundKill
-