Class QueuedCloningArena

java.lang.Object
de.marcely.bedwars.api.arena.QueuedCloningArena

public class QueuedCloningArena extends Object
Represents a queued entry within ArenaCloningManager.
  • Constructor Details

    • QueuedCloningArena

      public QueuedCloningArena(Arena arena)
      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 cloned
      playersPerTeam - The players per team amount that shall be applied for the cloned arena. May be null
      ignoreLimits - Whether certain limitations shall be ignored (see ArenaCloningManager.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

      public Arena getArena()
      Gets the arena that will be cloned in the future.
      Returns:
      The clone that this queue entry hold
    • getApplyingPlayersPerTeam

      @Nullable public @Nullable Integer 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 (see ArenaCloningManager.addToQueue(QueuedCloningArena)).
      Returns:
      true if this entry is ignroing the existing limitations
    • getCallback

      @Nullable @Deprecated public @Nullable Consumer<Optional<Arena>> getCallback()
      Deprecated.
      Use getCallbacks() instead. It may now have multiple callbacks
      An optional callback that returns the result of the cloning.
      Returns:
      The callback of this queue entry. May be null when there's none
    • getCallbacks

      public List<Consumer<Optional<Arena>>> getCallbacks()
      Gets all callbacks that are being called once the cloning has been finished.
      Returns:
      The list of callbacks
    • addCallback

      public void addCallback(Consumer<Optional<Arena>> callback)
      Adds a callback that will be called once the cloning has been finished.
      Parameters:
      callback - The callback to add