Class TownyRegenAPI
java.lang.Object
com.palmergames.bukkit.towny.regen.TownyRegenAPI
- Author:
- ElgarL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addPlaceholder
(org.bukkit.block.Block block) Add this block as a placeholder (will be replaced when it's regeneration task occurs)static void
addPlotChunkSnapshot
(PlotBlockData plotChunk) Saves a Plot Chunk snapshot to the datasourcestatic void
Add this task to the protection regen queue.static void
addToActiveRegeneration
(PlotBlockData plotChunk) Adds a Plot Chunk to the regeneration mapstatic void
addToRegenQueueList
(WorldCoord wc, boolean save) Adds a WorldCoord to the queue of the revert on unclaim feature.static boolean
beginProtectionRegenTask
(org.bukkit.block.Block block, int count, TownyWorld world, org.bukkit.event.Event event) Called from various explosion listeners.static void
Cancel all regenerating tasks and clear all queues.static CompletableFuture
<PlotBlockData> createPlotSnapshot
(@NotNull TownBlock townBlock) static void
finishPlotBlockData
(PlotBlockData plotChunk) Called when a PlotBlockData's revert-on-unclaim has been finished.static Collection
<PlotBlockData> static @Nullable PlotBlockData
getPlotChunk
(TownBlock townBlock) Gets a Plot Chunk from the regeneration mapstatic Map
<String, PlotBlockData> static PlotBlockData
getPlotChunkSnapshot
(TownBlock townBlock) Loads a Plot Chunk snapshot from the data sourcestatic String
getPlotKey
(TownBlock townBlock) static String
getPlotKey
(WorldCoord wc) static ProtectionRegenTask
GetProtectionRegenTask
(BlockLocation blockLocation) Fetch the relevant regen task for this blockstatic Collection
<WorldCoord> static void
static void
handleNewSnapshot
(@NotNull TownBlock townBlock) Creates a new snapshot and handles saving itstatic boolean
static boolean
static boolean
hasProtectionRegenTask
(BlockLocation blockLocation) Does a task for this block already exist?static boolean
isPlaceholder
(org.bukkit.block.Block block) Is this a placholder block?static boolean
static void
removeFromActiveRegeneration
(PlotBlockData plotChunk) Removes a Plot Chunk from the regeneration mapstatic void
Removes a WorldCoord from the queue of the revert on unclaim feature.static void
removePlaceholder
(org.bukkit.block.Block block) Remove this block from being tracked as a placeholder.static void
Remove this task form the protection regen queuestatic void
Removes a TownyWorld from the various Revert-on-Unclaim feature Lists/Table.
-
Constructor Details
-
TownyRegenAPI
public TownyRegenAPI()
-
-
Method Details
-
turnOffRevertOnUnclaimForWorld
Removes a TownyWorld from the various Revert-on-Unclaim feature Lists/Table.- Parameters:
world
- TownyWorld to remove.
-
finishPlotBlockData
Called when a PlotBlockData's revert-on-unclaim has been finished.- Parameters:
plotChunk
- PlotBlockData which finished up.
-
getRegenQueueList
- Returns:
- the list of WorldCoords which are waiting to be regenerated.
-
regenQueueHasAvailable
public static boolean regenQueueHasAvailable()- Returns:
- whether the regenQueue is empty.
-
removeFromRegenQueueList
Removes a WorldCoord from the queue of the revert on unclaim feature.- Parameters:
wc
- WorldCoord to add to the queue.
-
addToRegenQueueList
Adds a WorldCoord to the queue of the revert on unclaim feature.- Parameters:
wc
- WorldCoord to remove from thequeue.save
- true to save the regenlist.
-
getWorldCoordFromQueueForRegeneration
public static void getWorldCoordFromQueueForRegeneration() -
getPlotChunks
- Returns:
- the plotChunks which are being processed
-
getActivePlotBlockDatas
-
hasActiveRegenerations
public static boolean hasActiveRegenerations()- Returns:
- true if there are any chunks being processed.
-
hasActiveRegeneration
- Parameters:
wc
- WorldCoord to check for.- Returns:
- true if this WorldCoord is actively being processed.
-
removeFromActiveRegeneration
Removes a Plot Chunk from the regeneration map- Parameters:
plotChunk
- Chunk to remove (PlotBlockData)
-
addToActiveRegeneration
Adds a Plot Chunk to the regeneration map- Parameters:
plotChunk
- Chunk to add (PlotBlockData)
-
addPlotChunkSnapshot
Saves a Plot Chunk snapshot to the datasource- Parameters:
plotChunk
- - Chunk to take Snapshot (PlotBlockData)
-
getPlotChunkSnapshot
Loads a Plot Chunk snapshot from the data source- Parameters:
townBlock
- - TownBlock to get- Returns:
- loads the PlotData for the given townBlock or returns null.
-
getPlotChunk
Gets a Plot Chunk from the regeneration map- Parameters:
townBlock
- TownBlock to get- Returns:
- PlotChunks or null
-
getPlotKey
-
getPlotKey
-
beginProtectionRegenTask
public static boolean beginProtectionRegenTask(org.bukkit.block.Block block, int count, TownyWorld world, org.bukkit.event.Event event) Called from various explosion listeners.- Parameters:
block
- -Block
which is being exploded.count
- - int for setting the delay to do one block at a time.world
- -TownyWorld
for where the regen is being triggered.event
- - The Bukkit Event causing this explosion.- Returns:
- true if the protectiontask was begun successfully.
-
hasProtectionRegenTask
Does a task for this block already exist?- Parameters:
blockLocation
- - Location of the block- Returns:
- true if a task exists
-
GetProtectionRegenTask
Fetch the relevant regen task for this block- Parameters:
blockLocation
- - Location of the block.- Returns:
- the stored task, or null if there is none.
-
addProtectionRegenTask
Add this task to the protection regen queue.- Parameters:
task
- - ProtectionRegenTask to add to queue
-
removeProtectionRegenTask
Remove this task form the protection regen queue- Parameters:
task
- - ProtectionRegenTask to remove from queue
-
cancelProtectionRegenTasks
public static void cancelProtectionRegenTasks()Cancel all regenerating tasks and clear all queues. -
isPlaceholder
public static boolean isPlaceholder(org.bukkit.block.Block block) Is this a placholder block?- Parameters:
block
- - Block identifier- Returns:
- true if it is a placeholder
-
addPlaceholder
public static void addPlaceholder(org.bukkit.block.Block block) Add this block as a placeholder (will be replaced when it's regeneration task occurs)- Parameters:
block
- - Block identifier
-
removePlaceholder
public static void removePlaceholder(org.bukkit.block.Block block) Remove this block from being tracked as a placeholder.- Parameters:
block
- - Block identifier
-
handleNewSnapshot
Creates a new snapshot and handles saving it- Parameters:
townBlock
- The townblock to take a snapshot of
-
createPlotSnapshot
public static CompletableFuture<PlotBlockData> createPlotSnapshot(@NotNull @NotNull TownBlock townBlock)
-