Class TownyRegenAPI
java.lang.Object
com.palmergames.bukkit.towny.regen.TownyRegenAPI
- Author:
- ElgarL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddPlaceholder(org.bukkit.block.Block block) Add this block as a placeholder (will be replaced when it's regeneration task occurs)static voidaddPlotChunkSnapshot(PlotBlockData plotChunk) Saves a Plot Chunk snapshot to the datasourcestatic voidAdd this task to the protection regen queue.static voidaddToActiveRegeneration(PlotBlockData plotChunk) Adds a Plot Chunk to the regeneration mapstatic voidaddToRegenQueueList(WorldCoord wc, boolean save) Adds a WorldCoord to the queue of the revert on unclaim feature.static booleanbeginProtectionRegenTask(org.bukkit.block.Block block, int count, TownyWorld world, org.bukkit.event.Event event) Called from various explosion listeners.static voidCancel all regenerating tasks and clear all queues.static CompletableFuture<PlotBlockData> createPlotSnapshot(@NotNull TownBlock townBlock) static voidfinishPlotBlockData(PlotBlockData plotChunk) Called when a PlotBlockData's revert-on-unclaim has been finished.static Collection<PlotBlockData> static @Nullable PlotBlockDatagetPlotChunk(TownBlock townBlock) Gets a Plot Chunk from the regeneration mapstatic Map<String, PlotBlockData> static PlotBlockDatagetPlotChunkSnapshot(TownBlock townBlock) Loads a Plot Chunk snapshot from the data sourcestatic StringgetPlotKey(TownBlock townBlock) static StringgetPlotKey(WorldCoord wc) static ProtectionRegenTaskGetProtectionRegenTask(BlockLocation blockLocation) Fetch the relevant regen task for this blockstatic Collection<WorldCoord> static voidstatic voidhandleNewSnapshot(@NotNull TownBlock townBlock) Creates a new snapshot and handles saving itstatic booleanstatic booleanstatic booleanhasProtectionRegenTask(BlockLocation blockLocation) Does a task for this block already exist?static booleanisPlaceholder(org.bukkit.block.Block block) Is this a placholder block?static booleanstatic voidremoveFromActiveRegeneration(PlotBlockData plotChunk) Removes a Plot Chunk from the regeneration mapstatic voidRemoves a WorldCoord from the queue of the revert on unclaim feature.static voidremovePlaceholder(org.bukkit.block.Block block) Remove this block from being tracked as a placeholder.static voidRemove this task form the protection regen queuestatic voidRemoves 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- -Blockwhich is being exploded.count- - int for setting the delay to do one block at a time.world- -TownyWorldfor 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)
-