Package de.marcely.bedwars.api.arena
Class QueuedCloningArena
java.lang.Object
de.marcely.bedwars.api.arena.QueuedCloningArena
Represents a queued entry within
ArenaCloningManager
.-
Constructor Summary
ConstructorDescriptionQueuedCloningArena
(Arena arena) QueuedCloningArena
(Arena arena, @Nullable Integer playersPerTeam, boolean ignoreLimits, @Nullable Consumer<Optional<Arena>> callback) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCallback
(Consumer<Optional<Arena>> callback) Adds a callback that will be called once the cloning has been finished.@Nullable Integer
Gets the players per team amount that will be applied for the cloned arena.getArena()
Gets the arena that will be cloned in the future.Deprecated.Gets all callbacks that are being called once the cloning has been finished.boolean
Whether certain limitations shall be ignored (seeArenaCloningManager.addToQueue(QueuedCloningArena)
).
-
Constructor Details
-
QueuedCloningArena
- Parameters:
arena
- The arena that shall be cloned- Throws:
IllegalArgumentException
- when playersPerTeam is not null and > 1
-
QueuedCloningArena
public QueuedCloningArena(Arena arena, @Nullable @Nullable Integer playersPerTeam, boolean ignoreLimits, @Nullable @Nullable Consumer<Optional<Arena>> callback) - Parameters:
arena
- The arena that shall be clonedplayersPerTeam
- The players per team amount that shall be applied for the cloned arena. May benull
ignoreLimits
- Whether certain limitations shall be ignored (seeArenaCloningManager.addToQueue(QueuedCloningArena)
)callback
- An optional callback that returns the result of the cloning. In case it succeded, the callback will include the cloned arena. It is always being called on the main thread- Throws:
IllegalArgumentException
- when playersPerTeam is not null and > 1
-
-
Method Details
-
getArena
Gets the arena that will be cloned in the future.- Returns:
- The clone that this queue entry hold
-
getApplyingPlayersPerTeam
Gets the players per team amount that will be applied for the cloned arena.Basically calls
Arena.setPlayersPerTeam(int)
once the arena has been cloned.null
means that the original players per team amount stays as it was.- Returns:
- The players per team amount of the new arena, or
null
if it stays the same
-
isIgnoringLimits
public boolean isIgnoringLimits()Whether certain limitations shall be ignored (seeArenaCloningManager.addToQueue(QueuedCloningArena)
).- Returns:
true
if this entry is ignroing the existing limitations
-
getCallback
Deprecated.UsegetCallbacks()
instead. It may now have multiple callbacksAn optional callback that returns the result of the cloning.- Returns:
- The callback of this queue entry. May be
null
when there's none
-
getCallbacks
Gets all callbacks that are being called once the cloning has been finished.- Returns:
- The list of callbacks
-
addCallback
Adds a callback that will be called once the cloning has been finished.- Parameters:
callback
- The callback to add
-
getCallbacks()
instead.