Interface ArenaCloningManager
Note that it is not possible to interact with it while isActive()
returns false.
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
addToQueue
(Arena arena) Adds an arena to the queue.default boolean
addToQueue
(Arena arena, boolean ignoreLimits) Adds an arena to the queue.default boolean
addToQueue
(Arena arena, boolean ignoreLimits, @Nullable Consumer<Optional<Arena>> callback) Adds an arena to the queue.boolean
addToQueue
(QueuedCloningArena entry) Adds an arena to the queue.Gets all existing arenas that have been cloned.Gets all worlds whose purpose is to only contain the cloned arenas.getQueue()
Gets all arenas that are enqueued for the cloning process.Gets all entries that are enqueued for the cloning process.boolean
isActive()
Gets whether this manager is currently actively processing the cloning of new arenas.boolean
removeFromQueue
(Arena arena) Removes a single instance of an arena from the queue.
-
Method Details
-
isActive
boolean isActive()Gets whether this manager is currently actively processing the cloning of new arenas.In case this method returns
false
, the methods under this class, that modify e.g. the queue, won't have any effect.Whether the manager is active is being determined by the configuration of the "auto-cloning-enabled" config (located within the config.cm2 file).
- Returns:
- Whether this manager is active or not
-
getClonedArenas
Collection<Arena> getClonedArenas()Gets all existing arenas that have been cloned.- Returns:
- An immutable collection of arenas that have been cloned
-
getClonePurposeWorlds
Collection<World> getClonePurposeWorlds()Gets all worlds whose purpose is to only contain the cloned arenas.The processor is creating new temporary worlds for the cloned arenas. They automatically get deleted when not needed anymore.
- Returns:
- An immutable collection of worlds used for the cloning system
-
getQueue
Collection<Arena> getQueue()Gets all arenas that are enqueued for the cloning process.It is legit for it to contain the same arena more than once. The pure existence of an arena within this Collection is not a promise for the arena to be actually cloned.
A separate thread will be pulling the arenas from the queue.
- Returns:
- An immmutable collection of arenas that may will be cloned in the future
- See Also:
-
getQueueEntries
Collection<QueuedCloningArena> getQueueEntries()Gets all entries that are enqueued for the cloning process.It is legit for it to contain the same arena more than once. The pure existence of an arena within this Collection is not a promise for the arena to be actually cloned.
A separate thread will be pulling the arenas from the queue.
- Returns:
- An immmutable collection of arenas that may will be cloned in the future
- See Also:
-
addToQueue
Adds an arena to the queue.There are certain limits within the configurations that limit the amount of arenas that may be cloned. You may overcome that limit using the
ignoreLimits
parameter.This method fully supports async operations.
It is also okay for an arena to be added multiple times. It will be cloned that amount of times.An arena may not be cloned (this method returns
false
) for the following reasons:
-isActive()
returns false
- Arena itself is a cloned arena (Arena.isCloned()
returns true)
- Arena is not a "normal" regeneration type (RegenerationType.isNormal()
returns false)
- The status of the arena isArenaStatus.STOPPED
- The arena depends on SWM while SWM is not installed
- Arena does not exist
- There are limits preventing it (ignoreLimits
is set to false)
- It is a part of the 'auto-cloning-excluded-arenas' configThe pure existence of an arena within this Collection is not a promise for the arena to be actually cloned. Certain states may have changed with the start of its theoretical cloning process.
- Parameters:
entry
- The entry shall be added. Create it using its constructors- Returns:
true
when an arena has been added to the queue. This does not tell whether it actually succeded the cloning! Use the callback for that- See Also:
-
addToQueue
default boolean addToQueue(Arena arena, boolean ignoreLimits, @Nullable @Nullable Consumer<Optional<Arena>> callback) Adds an arena to the queue.There are certain limits within the configurations that limit the amount of arenas that may be cloned. You may overcome that limit using the
ignoreLimits
parameter.This method fully supports async operations.
It is also okay for an arena to be added multiple times. It will be cloned that amount of times.An arena may not be cloned (this method returns
false
) for the following reasons:
-isActive()
returns false
- Arena itself is a cloned arena (Arena.isCloned()
returns true)
- Arena is not a "normal" regeneration type (RegenerationType.isNormal()
returns false)
- The status of the arena isArenaStatus.STOPPED
- The arena depends on SWM while SWM is not installed
- Arena does not exist
- There are limits preventing it (ignoreLimits
is set to false)
- It is a part of the 'auto-cloning-excluded-arenas' configThe pure existence of an arena within this Collection is not a promise for the arena to be actually cloned. Certain states may have changed with the start of its theoretical cloning process.
- Parameters:
arena
- The arena that shall be clonedignoreLimits
- Whether certain limitations shall be ignoredcallback
- 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- Returns:
true
when an arena has been added to the queue. This does not tell whether it actually succeded the cloning! Use the callback for that- See Also:
-
addToQueue
Adds an arena to the queue.There are certain limits within the configurations that limit the amount of arenas that may be cloned. You may overcome that limit using the
ignoreLimits
parameter.This method fully supports async operations.
It is also okay for an arena to be added multiple times. It will be cloned that amount of times.An arena may not be cloned (this method returns
false
) for the following reasons:
-isActive()
returns false
- Arena itself is a cloned arena (Arena.isCloned()
returns true)
- Arena is not a "normal" regeneration type (RegenerationType.isNormal()
returns false)
- The status of the arena isArenaStatus.STOPPED
- The arena depends on SWM while SWM is not installed
- Arena does not exist
- There are limits preventing it (ignoreLimits
is set to false)
- It is a part of the 'auto-cloning-excluded-arenas' configThe pure existence of an arena within this Collection is not a promise for the arena to be actually cloned. Certain states may have changed with the start of its theoretical cloning process.
- Parameters:
arena
- The arena that shall be clonedignoreLimits
- Whether certain limitations shall be ignored- Returns:
true
when an arena has been added to the queue. This does not tell whether it actually succeded the cloning!- See Also:
-
addToQueue
Adds an arena to the queue.There are certain limits within the configurations that limit the amount of arenas that may be cloned.
This method fully supports async operations.
It is also okay for an arena to be added multiple times. It will be cloned that amount of times.An arena may not be cloned (this method returns
false
) for the following reasons:
-isActive()
returns false
- Arena itself is a cloned arena (Arena.isCloned()
returns true)
- Arena is not a "normal" regeneration type (RegenerationType.isNormal()
returns false)
- The status of the arena isArenaStatus.STOPPED
- The arena depends on SWM while SWM is not installed
- Arena does not exist
- There are limits preventing it
- It is a part of the 'auto-cloning-excluded-arenas' configThe pure existence of an arena within this Collection is not a promise for the arena to be actually cloned. Certain states may have changed with the start of its theoretical cloning process.
- Parameters:
arena
- The arena that shall be cloned- Returns:
true
when an arena has been added to the queue. This does not tell whether it actually succeded the cloning!- See Also:
-
removeFromQueue
Removes a single instance of an arena from the queue.This method fully supports async operations.
- Parameters:
arena
- The arena that shall not be cloned (or once less)- Returns:
true
in case at least one instance has been found and one has been removed- See Also:
-