public interface Round extends MetadataHolder, ComponentOwner, Component<Arena>
Round
backed by Flint.Modifier and Type | Interface and Description |
---|---|
static interface |
Round.EndParameter
Specifies parameters which may be passed to
end(EndParameter...) in order to specify the precise
behavior of the engine while ending the Round . |
Modifier and Type | Method and Description |
---|---|
Challenger |
_INVALID_addChallenger(UUID uuid)
Deprecated.
Violates basic principle of exceptions - use
addChallenger(UUID) |
JoinResult |
addChallenger(UUID uuid)
|
void |
broadcast(String message)
|
Team |
createTeam(String id)
|
void |
end()
Deprecated.
Made redundant by introduction of an equivalent var-args method
|
void |
end(boolean rollback)
Deprecated.
Use
end(EndParameter...) in correspondence with
Round.EndParameter.RollbackBehavior |
void |
end(Round.EndParameter... endParameters)
Deprecated.
|
Arena |
getArena()
|
Optional<Challenger> |
getChallenger(UUID uuid)
|
ImmutableList<Challenger> |
getChallengers()
|
<T> T |
getConfigValue(RoundConfigNode<T> node)
Gets the value of the given
RoundConfigNode for this
Round , or the server value if it is not set. |
LifecycleStage |
getLifecycleStage()
Gets this
Round 's current LifecycleStage . |
LifecycleStage |
getLifecycleStage(int index)
Gets the
LifecycleStage at the given index for this
Round . |
Optional<LifecycleStage> |
getLifecycleStage(String id)
Gets the
LifecycleStage by the given ID in this Round . |
ImmutableSet<LifecycleStage> |
getLifecycleStages()
Gets an immutable
ImmutableSet of this Round 's defined
lifecycle stages. |
Optional<LifecycleStage> |
getNextLifecycleStage()
Gets this
Round 's next LifecycleStage , if applicable. |
Team |
getOrCreateTeam(String id)
|
long |
getRemainingTime()
Gets the time in seconds until this
Round is due to change
its lifecycle stage . |
ImmutableList<Challenger> |
getSpectators()
Returns the subset of
Challenger s in this Round who are
marked as spectating. |
Optional<Team> |
getTeam(String id)
|
ImmutableList<Team> |
getTeams()
|
long |
getTime()
Gets the current state of this
Round 's timer in seconds. |
boolean |
isEnding()
Returns whether this
Round is currently ending. |
boolean |
isTimerTicking()
Returns whether this
Round 's timer is currently ticking. |
void |
nextLifecycleStage()
Progresses this
Round to its next LifecycleStage . |
Location3D |
nextSpawnPoint()
Retrieves the next available spawn point.
|
void |
removeChallenger(Challenger challenger)
Removes the given
Challenger from this Round , returning
them to their original location before joining. |
void |
removeChallenger(UUID uuid)
|
void |
removeTeam(String id)
|
void |
removeTeam(Team team)
|
void |
resetTimer()
Sets this
Round 's lifecycle stage to its initial state and resets
and stops the timer. |
<T> void |
setConfigValue(RoundConfigNode<T> node,
T value)
Sets the value of the given
RoundConfigNode for this
Round . |
void |
setLifecycleStage(LifecycleStage stage)
Sets this
Round 's current LifecycleStage . |
void |
setLifecycleStage(LifecycleStage stage,
boolean resetTimer)
Sets this
Round 's current LifecycleStage . |
void |
setTime(long time)
Sets the current state of this
Round 's timer in seconds. |
void |
setTimerTicking(boolean ticking)
Sets whether this
Round 's timer is currently ticking. |
getMetadata
Arena getArena() throws OrphanedComponentException
Arena
this Round
is owned byOrphanedComponentException
- If this object is orphaned (see
Component
for details)ImmutableList<Challenger> getChallengers() throws OrphanedComponentException
ImmutableList
of Challenger
s in this
Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)Optional<Challenger> getChallenger(UUID uuid) throws OrphanedComponentException
uuid
- The UUID
to look upChallenger
from this Round
with the given
UUID
.OrphanedComponentException
- If this object is orphaned (see
Component
for details)@Deprecated Challenger _INVALID_addChallenger(UUID uuid) throws RoundJoinException, OrphanedComponentException
addChallenger(UUID)
uuid
- The unique ID of the player to add to this Round
Challenger
objectIllegalStateException
- If no spawn points are configured for this
Round
's Arena
RoundJoinException
- If the player fails to be added to the
Round
for any given reason (obtainable through
RoundJoinException.getReason()
)OrphanedComponentException
- If this object is orphaned (see
Component
for details)JoinResult addChallenger(UUID uuid) throws OrphanedComponentException
uuid
- The unique ID of the player to add to this Round
result
of the joinIllegalStateException
- If no spawn points are configured for this
Round
's Arena
OrphanedComponentException
- If this object is orphaned (see
Component
for details)void removeChallenger(UUID uuid) throws IllegalArgumentException, OrphanedComponentException
UUID
from this Round
.
Note that this will orphan the Challenger
object associated
with the given UUID
, causing all of its methods to throw
OrphanedComponentException
s.
uuid
- The UUID
of the player to removeIllegalArgumentException
- If this Round
does not contain a
player by the given UUID
OrphanedComponentException
- If this object is orphaned (see
Component
for details)void removeChallenger(Challenger challenger) throws IllegalArgumentException, OrphanedComponentException
Challenger
from this Round
, returning
them to their original location before joining.
Note that this will orphan the passed Challenger
object,
causing all of its methods to throw OrphanedComponentException
s.
challenger
- The Challenger
to removeIllegalArgumentException
- If this Round
is not the one
containing challenger
OrphanedComponentException
- If this object is orphaned (see
Component
for details)Location3D nextSpawnPoint()
If the round's spawning mode is set to SpawningMode.RANDOM
, a
random point will be selected. Otherwise, if it is set to
SpawningMode.SEQUENTIAL
, the next point in sequence will be
selected and the selection counter will be incremented.
ImmutableList<Team> getTeams() throws OrphanedComponentException
ImmutableList
of Team
s in this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)Optional<Team> getTeam(String id) throws OrphanedComponentException
id
- The identifier to look upTeam
with the given identifierOrphanedComponentException
- If this object is orphaned (see
Component
for details)Team createTeam(String id) throws IllegalArgumentException, OrphanedComponentException
id
- The identifier of the new Team
Team
.IllegalArgumentException
- If a Team
with the given
identifer already existsOrphanedComponentException
- If this object is orphaned (see
Component
for details)Team getOrCreateTeam(String id) throws OrphanedComponentException
id
- The identifier to look upTeam
.OrphanedComponentException
- If this object is orphaned (see
Component
for details)void removeTeam(String id) throws IllegalArgumentException, OrphanedComponentException
Team
with the given identifier from this
Round
.
Note that calling this method will orphan the Team
object
associated with the given ID, causing all of its methods to throw
OrphanedComponentException
s.
id
- The identifier of the Team
to removeIllegalArgumentException
- If this Round
does not contain
a Team
by the given IDOrphanedComponentException
void removeTeam(Team team) throws IllegalArgumentException, OrphanedComponentException
Team
from this Round
.
Note that calling this method will orphan the passed Team
object, causing all of its methods to throw
OrphanedComponentException
s.
team
- The Team
to removeIllegalArgumentException
- If the given Team
object is
parented by a different Round
or has already been removed
from this oneOrphanedComponentException
- If this object is orphaned (see
Component
for details)ImmutableList<Challenger> getSpectators() throws OrphanedComponentException
Challenger
s in this Round
who are
marked as spectating.Challenger
s in this Round
who are
marked as spectatingOrphanedComponentException
- If this object is orphaned (see
Component
for details)void broadcast(String message) throws OrphanedComponentException
message
- The string to broadcastOrphanedComponentException
- If this object is orphaned (see
Component
for details)ImmutableSet<LifecycleStage> getLifecycleStages() throws OrphanedComponentException
ImmutableSet
of this Round
's defined
lifecycle stages.Round
's defined lifecycle stagesOrphanedComponentException
- If this object is orphaned (see
Component
for details)LifecycleStage getLifecycleStage() throws OrphanedComponentException
Round
's current LifecycleStage
.Round
's current LifecycleStage
OrphanedComponentException
- If this object is orphaned (see
Component
for details)void setLifecycleStage(LifecycleStage stage, boolean resetTimer) throws IllegalArgumentException, OrphanedComponentException
Round
's current LifecycleStage
.stage
- The new LifecycleStage
for the Round
resetTimer
- Whether to reset the timer to 0
(defaults to
false
if omitted)IllegalArgumentException
- If stage
is not defined for
this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)void setLifecycleStage(LifecycleStage stage) throws IllegalArgumentException, OrphanedComponentException
Round
's current LifecycleStage
.
Note: Invocation of this method will not
reset a round's numerical timer unless the boolean resetTimer
parameter is provided.
stage
- The new LifecycleStage
for the Round
IllegalArgumentException
- If stage
is not defined for
this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)Optional<LifecycleStage> getLifecycleStage(String id) throws OrphanedComponentException
LifecycleStage
by the given ID in this Round
.id
- The ID of the LifecycleStage
to getLifecycleStage
by the given ID in this Round
,
or Optional.absent()
if one does not existOrphanedComponentException
- If this object is orphaned (see
Component
for details)LifecycleStage getLifecycleStage(int index) throws IndexOutOfBoundsException, OrphanedComponentException
LifecycleStage
at the given index for this
Round
.index
- The index of the LifecycleStage
to getLifecycleStage
at the given indexIndexOutOfBoundsException
- If index
is greater than
the highest defined indexOrphanedComponentException
- If this object is orphaned (see
Component
for details)Optional<LifecycleStage> getNextLifecycleStage() throws OrphanedComponentException
Round
's next LifecycleStage
, if applicable.Round
's next LifecycleStage
, or
Optional.absent()
if the current stage is the final definedOrphanedComponentException
- If this object is orphaned (see
Component
for details)void nextLifecycleStage() throws IllegalStateException, OrphanedComponentException
Round
to its next LifecycleStage
.
Note: Unlike
setLifecycleStage(LifecycleStage)
, invocation of this
method will implicitly reset a round's numerical timer.
IllegalStateException
- If the current LifecycleStage
is
the last one definedOrphanedComponentException
- If this object is orphaned (see
Component
for details)long getTime() throws OrphanedComponentException
Round
's timer in seconds.
Typically, this represents the time since its last lifecycle stage change, although this is not absolute.
Round
's timer in secondsOrphanedComponentException
- If this object is orphaned (see
Component
for details)void setTime(long time) throws OrphanedComponentException
Round
's timer in seconds.time
- The current state of this Round
's timer in secondsOrphanedComponentException
- If this object is orphaned (see
Component
for details)long getRemainingTime() throws OrphanedComponentException
Round
is due to change
its lifecycle stage
.Round
is due to change
its lifecycle stage
, or -1
if the
current stage is untimedOrphanedComponentException
- If this object is orphaned (see
Component
for details)boolean isTimerTicking() throws OrphanedComponentException
Round
's timer is currently ticking.Round
's timer is currently tickingOrphanedComponentException
- If this object is orphaned (see
Component
for details)void setTimerTicking(boolean ticking) throws OrphanedComponentException
Round
's timer is currently ticking.ticking
- Whether this Round
's timer is currently tickingOrphanedComponentException
- If this object is orphaned (see
Component
for details)void resetTimer() throws OrphanedComponentException
Round
's lifecycle stage to its initial state and resets
and stops the timer.OrphanedComponentException
- If this object is orphaned (see
Component
for details)void end() throws IllegalStateException, OrphanedComponentException
Round
by resetting its timer, removing all
Challenger
s and returning them to their original locations, and
rolling back its arena if ConfigNode.ROLLBACK_ON_END
is
true
.
Note that calling this method will orphan this Round
object,
causing all of its methods to throw OrphanedComponentException
s.
IllegalStateException
- If an end
method has already been
called upon this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)@Deprecated void end(Round.EndParameter... endParameters) throws IllegalStateException, OrphanedComponentException
Round
with the given Round.EndParameter
s by resetting
its timer, removing all Challenger
s and returning them to their
original locations.
Note that calling this method will orphan this Round
object,
causing all of its methods to throw OrphanedComponentException
s.
endParameters
- An array of parameters to consider while ending the
round (see Round.EndParameter
for more info)IllegalStateException
- If an end
method has already been
called upon this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)@Deprecated void end(boolean rollback) throws IllegalStateException, OrphanedComponentException
end(EndParameter...)
in correspondence with
Round.EndParameter.RollbackBehavior
Round
by resetting its timer, removing all
Challenger
s and returning them to thieir original locations, and,
if rollback
is true
, rolling back its arena.
Note that calling this method will orphan this Round
object,
causing all of its methods to throw OrphanedComponentException
s.
rollback
- Whether this Round
's arena should be rolled backIllegalStateException
- If an end
method has already been
called upon this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)boolean isEnding() throws OrphanedComponentException
Round
is currently ending. This method
returns true during and only during the period between the Round
being requested to end, and the Round
being fully ended and
orphaned.Round
is currently in the process of ending.OrphanedComponentException
- If this object is orphaned (see
Component
for details)<T> T getConfigValue(RoundConfigNode<T> node) throws OrphanedComponentException
RoundConfigNode
for this
Round
, or the server value if it is not set.T
- The value type associated with node
node
- The RoundConfigNode
to look upnode
OrphanedComponentException
- If this object is orphaned (see
Component
for details)<T> void setConfigValue(RoundConfigNode<T> node, T value) throws OrphanedComponentException
RoundConfigNode
for this
Round
.T
- The value type associated with node
node
- The RoundConfigNode
to setvalue
- The new value associated with node
OrphanedComponentException
- If this object is orphaned (see
Component
for details)