Class FaweAPI

java.lang.Object
com.fastasyncworldedit.core.FaweAPI

public class FaweAPI extends Object
The FaweAPI class offers a few useful functions.
- This class is not intended to replace the WorldEdit API
- With FAWE installed, you can use the EditSession and other WorldEdit classes from an async thread.

FaweAPI.[some method]
  • Constructor Details

    • FaweAPI

      public FaweAPI()
  • Method Details

    • getTaskManager

      public static TaskManager getTaskManager()
      The TaskManager has some useful methods for doing things asynchronously.
      Returns:
      TaskManager
    • createQueue

      public static IQueueExtent<IQueueChunk> createQueue(World world, boolean autoQueue)
      You can either use a IQueueExtent or an EditSession to change blocks.

      The IQueueExtent skips a bit of overhead, so it is marginally faster. EditSession can do a lot more. Remember to commit when you are done!

      Parameters:
      world - The name of the world
      autoQueue - If it should start dispatching before you enqueue it.
      Returns:
      the queue extent
    • getWorld

      public static World getWorld(String worldName)
    • upload

      public static URL upload(Clipboard clipboard, ClipboardFormat format)
      Upload the clipboard to the configured web interface.
      Parameters:
      clipboard - The clipboard (may not be null)
      format - The format to use (some formats may not be supported)
      Returns:
      The download URL or null
    • load

      public static Clipboard load(File file) throws IOException
      Just forwards to ClipboardFormat.SCHEMATIC.load(file).
      Parameters:
      file - the file to load
      Returns:
      a clipboard containing the schematic
      Throws:
      IOException
      See Also:
    • getMaskManagers

      public static Set<FaweMaskManager> getMaskManagers()
      Get a list of supported protection plugin masks.
      Returns:
      Set of FaweMaskManager
    • isMemoryLimited

      public static boolean isMemoryLimited()
      Check if the server has more than the configured low memory threshold.
      Returns:
      True if the server has limited memory
    • getRegions

      public static Region[] getRegions(Player player)
      Get a player's allowed WorldEdit region(s).
    • getRegions

      public static Region[] getRegions(Player player, FaweMaskManager.MaskType type, boolean isWhiteList)
      Get a player's allowed WorldEdit region(s).
      Parameters:
      player - Player to get mask of
      type - Mask type; whether to check if the player is an owner of a member of the regions
      isWhiteList - If searching for whitelist or blacklist regions. True if whitelist
      Returns:
      array of allowed regions if whitelist, else of disallowed regions.
    • cancelEdit

      public static void cancelEdit(AbstractDelegateExtent extent, com.sk89q.worldedit.util.formatting.text.Component reason)
      Cancel the edit with the following extent.

      The extent must be the one being used by an EditSession, otherwise an error will be thrown. Insert an extent into the EditSession using the EditSessionEvent.

      See Also:
    • addMaskManager

      public static void addMaskManager(FaweMaskManager maskMan)
    • getChangeSetFromFile

      public static DiskStorageHistory getChangeSetFromFile(File file)
      Get the DiskStorageHistory object representing a File.
    • getBDFiles

      public static List<DiskStorageHistory> getBDFiles(Location origin, UUID user, int radius, long timediff, boolean shallow)
      Used in the rollback to generate a list of DiskStorageHistory objects.
      Parameters:
      origin - - The origin location
      user - - The uuid (may be null)
      radius - - The radius from the origin of the edit
      timediff - - The max age of the file in milliseconds
      shallow - - If shallow is true, FAWE will only read the first Settings.HISTORY.BUFFER_SIZE bytes to obtain history info
      Returns:
      a list of DiskStorageHistory Objects
    • getChangeSetFromDisk

      public static DiskStorageHistory getChangeSetFromDisk(World world, UUID uuid, int index)
      The DiskStorageHistory class is what FAWE uses to represent the undo on disk.
    • fixLighting

      public static int fixLighting(World world, Region selection, @Nullable IQueueExtent<IQueueChunk> queue, RelightMode mode)
      Fix the lighting in a selection. This is a multi-step process as outlined below.
      1. Removes all lighting, then relights.
      2. Relights in parallel (if enabled) for best performance.
      3. Resends the chunks to the client.
      Parameters:
      world - World to relight in
      selection - Region to relight
      queue - Queue to relight in/from
      mode - The mode to relight with
      Returns:
      Chunks changed
    • addMemoryLimitedTask

      public static void addMemoryLimitedTask(Runnable run)
      Runs a task when the server is low on memory.
    • addMemoryPlentifulTask

      public static void addMemoryPlentifulTask(Runnable run)
      Runs a task when the server is no longer low on memory.
    • getTranslations

      public static Map<String,String> getTranslations(Locale locale)