Class TownyRegenAPI

java.lang.Object
com.palmergames.bukkit.towny.regen.TownyRegenAPI

public class TownyRegenAPI extends Object
Author:
ElgarL
  • Constructor Details

    • TownyRegenAPI

      public TownyRegenAPI()
  • Method Details

    • turnOffRevertOnUnclaimForWorld

      public static void turnOffRevertOnUnclaimForWorld(TownyWorld world)
      Removes a TownyWorld from the various Revert-on-Unclaim feature Lists/Table.
      Parameters:
      world - TownyWorld to remove.
    • finishPlotBlockData

      public static void finishPlotBlockData(PlotBlockData plotChunk)
      Called when a PlotBlockData's revert-on-unclaim has been finished.
      Parameters:
      plotChunk - PlotBlockData which finished up.
    • getRegenQueueList

      public static Collection<WorldCoord> getRegenQueueList()
      Returns:
      the list of WorldCoords which are waiting to be regenerated.
    • regenQueueHasAvailable

      public static boolean regenQueueHasAvailable()
      Returns:
      whether the regenQueue is empty.
    • removeFromRegenQueueList

      public static void removeFromRegenQueueList(WorldCoord wc)
      Removes a WorldCoord from the queue of the revert on unclaim feature.
      Parameters:
      wc - WorldCoord to add to the queue.
    • addToRegenQueueList

      public static void addToRegenQueueList(WorldCoord wc, boolean save)
      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

      public static Map<String,PlotBlockData> getPlotChunks()
      Returns:
      the plotChunks which are being processed
    • getActivePlotBlockDatas

      public static Collection<PlotBlockData> getActivePlotBlockDatas()
    • hasActiveRegenerations

      public static boolean hasActiveRegenerations()
      Returns:
      true if there are any chunks being processed.
    • hasActiveRegeneration

      public static boolean hasActiveRegeneration(WorldCoord wc)
      Parameters:
      wc - WorldCoord to check for.
      Returns:
      true if this WorldCoord is actively being processed.
    • removeFromActiveRegeneration

      public static void removeFromActiveRegeneration(PlotBlockData plotChunk)
      Removes a Plot Chunk from the regeneration map
      Parameters:
      plotChunk - Chunk to remove (PlotBlockData)
    • addToActiveRegeneration

      public static void addToActiveRegeneration(PlotBlockData plotChunk)
      Adds a Plot Chunk to the regeneration map
      Parameters:
      plotChunk - Chunk to add (PlotBlockData)
    • addPlotChunkSnapshot

      public static void addPlotChunkSnapshot(PlotBlockData plotChunk)
      Saves a Plot Chunk snapshot to the datasource
      Parameters:
      plotChunk - - Chunk to take Snapshot (PlotBlockData)
    • getPlotChunkSnapshot

      public static PlotBlockData getPlotChunkSnapshot(TownBlock townBlock)
      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

      @Nullable public static @Nullable PlotBlockData getPlotChunk(TownBlock townBlock)
      Gets a Plot Chunk from the regeneration map
      Parameters:
      townBlock - TownBlock to get
      Returns:
      PlotChunks or null
    • getPlotKey

      public static String getPlotKey(TownBlock townBlock)
    • getPlotKey

      public static String getPlotKey(WorldCoord wc)
    • 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

      public static boolean hasProtectionRegenTask(BlockLocation blockLocation)
      Does a task for this block already exist?
      Parameters:
      blockLocation - - Location of the block
      Returns:
      true if a task exists
    • GetProtectionRegenTask

      public static ProtectionRegenTask GetProtectionRegenTask(BlockLocation blockLocation)
      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

      public static void addProtectionRegenTask(ProtectionRegenTask task)
      Add this task to the protection regen queue.
      Parameters:
      task - - ProtectionRegenTask to add to queue
    • removeProtectionRegenTask

      public static void removeProtectionRegenTask(ProtectionRegenTask task)
      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

      public static void handleNewSnapshot(@NotNull @NotNull TownBlock townBlock)
      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)