public interface Round extends MetadataHolder, ComponentOwner, Component<Arena>
Round
backed by Flint.Modifier and Type | Method and Description |
---|---|
Challenger |
_INVALID_addChallenger(java.util.UUID uuid)
Deprecated.
Violates basic principle of exceptions - use
addChallenger(UUID) |
JoinResult |
addChallenger(java.util.UUID uuid)
Adds the player by the given
UUID to this Round . |
void |
broadcast(java.lang.String message)
|
Team |
createTeam(java.lang.String id)
|
void |
end()
Ends this
Round by resetting its timer, removing all
Challenger s and returning them to their original locations, and
rolling back its arena. |
void |
end(boolean rollback)
Ends this
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. |
Arena |
getArena()
|
com.google.common.base.Optional<Challenger> |
getChallenger(java.util.UUID uuid)
|
com.google.common.collect.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 . |
com.google.common.base.Optional<LifecycleStage> |
getLifecycleStage(java.lang.String id)
Gets the
LifecycleStage by the given ID in this Round . |
com.google.common.collect.ImmutableSet<LifecycleStage> |
getLifecycleStages()
Gets an immutable
ImmutableSet of this Round 's defined
lifecycle stages. |
com.google.common.base.Optional<LifecycleStage> |
getNextLifecycleStage()
Gets this
Round 's next LifecycleStage , if applicable. |
Team |
getOrCreateTeam(java.lang.String id)
|
long |
getRemainingTime()
Gets the time in seconds until this
Round is due to change
its lifecycle stage . |
com.google.common.collect.ImmutableList<Challenger> |
getSpectators()
Returns the subset of
Challenger s in this Round who are
marked as spectating. |
com.google.common.base.Optional<Team> |
getTeam(java.lang.String id)
|
com.google.common.collect.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(java.util.UUID uuid)
Removes the player by the given
UUID from this Round . |
void |
removeTeam(java.lang.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)com.google.common.collect.ImmutableList<Challenger> getChallengers() throws OrphanedComponentException
ImmutableList
of Challenger
s in this
Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)com.google.common.base.Optional<Challenger> getChallenger(java.util.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(java.util.UUID uuid) throws RoundJoinException, OrphanedComponentException
addChallenger(UUID)
UUID
to this Round
.
This method will not exist at runtime - do not use it!
uuid
- The unique ID of the player to add to this Round
Challenger
objectjava.lang.IllegalStateException
- 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(java.util.UUID uuid) throws OrphanedComponentException
UUID
to this Round
.
This method will not exist at runtime - do not use it!
void removeChallenger(java.util.UUID uuid) throws java.lang.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 removejava.lang.IllegalArgumentException
- 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 java.lang.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 removejava.lang.IllegalArgumentException
- 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.
com.google.common.collect.ImmutableList<Team> getTeams() throws OrphanedComponentException
ImmutableList
of Team
s in this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)com.google.common.base.Optional<Team> getTeam(java.lang.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(java.lang.String id) throws java.lang.IllegalArgumentException, OrphanedComponentException
id
- The identifier of the new Team
Team
.java.lang.IllegalArgumentException
- If a Team
with the given
identifer already existsOrphanedComponentException
- If this object is orphaned (see
Component
for details)Team getOrCreateTeam(java.lang.String id) throws OrphanedComponentException
id
- The identifier to look upTeam
.OrphanedComponentException
- If this object is orphaned (see
Component
for details)void removeTeam(java.lang.String id) throws java.lang.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 removejava.lang.IllegalArgumentException
- If this Round
does not contain
a Team
by the given IDOrphanedComponentException
void removeTeam(Team team) throws java.lang.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 removejava.lang.IllegalArgumentException
- 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)com.google.common.collect.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(java.lang.String message) throws OrphanedComponentException
message
- The string to broadcastOrphanedComponentException
- If this object is orphaned (see
Component
for details)com.google.common.collect.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 java.lang.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)java.lang.IllegalArgumentException
- If stage
is not defined for
this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)void setLifecycleStage(LifecycleStage stage) throws java.lang.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
java.lang.IllegalArgumentException
- If stage
is not defined for
this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)com.google.common.base.Optional<LifecycleStage> getLifecycleStage(java.lang.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 java.lang.IndexOutOfBoundsException, OrphanedComponentException
LifecycleStage
at the given index for this
Round
.index
- The index of the LifecycleStage
to getLifecycleStage
at the given indexjava.lang.IndexOutOfBoundsException
- If index
is greater than
the highest defined indexOrphanedComponentException
- If this object is orphaned (see
Component
for details)com.google.common.base.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 java.lang.IllegalStateException, OrphanedComponentException
Round
to its next LifecycleStage
.
Note: Unlike
setLifecycleStage(LifecycleStage)
, invocation of this
method will implicitly reset a round's numerical timer.
java.lang.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 java.lang.IllegalStateException, OrphanedComponentException
Round
by resetting its timer, removing all
Challenger
s and returning them to their original locations, and
rolling back its arena.
Note that calling this method will orphan this Round
object,
causing all of its methods to throw OrphanedComponentException
s.
java.lang.IllegalStateException
- If an end
method has already been
called upon this Round
OrphanedComponentException
- If this object is orphaned (see
Component
for details)void end(boolean rollback) throws java.lang.IllegalStateException, OrphanedComponentException
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 backjava.lang.IllegalStateException
- 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)