Package com.fastasyncworldedit.core
Class FaweAPI
java.lang.Object
com.fastasyncworldedit.core.FaweAPI
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]
- 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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addMaskManager
(FaweMaskManager maskMan) static void
Runs a task when the server is low on memory.static void
Runs a task when the server is no longer low on memory.static void
cancelEdit
(AbstractDelegateExtent extent, com.sk89q.worldedit.util.formatting.text.Component reason) Cancel the edit with the following extent.static IQueueExtent
<IQueueChunk> createQueue
(World world, boolean autoQueue) You can either use aIQueueExtent
or anEditSession
to change blocks.static int
fixLighting
(World world, Region selection, IQueueExtent<IQueueChunk> queue, RelightMode mode) Fix the lighting in a selection.static List
<DiskStorageHistory> getBDFiles
(Location origin, UUID user, int radius, long timediff, boolean shallow) Used in the rollback to generate a list ofDiskStorageHistory
objects.static DiskStorageHistory
getChangeSetFromDisk
(World world, UUID uuid, int index) The DiskStorageHistory class is what FAWE uses to represent the undo on disk.static DiskStorageHistory
getChangeSetFromFile
(File file) Get the DiskStorageHistory object representing a File.static Set
<FaweMaskManager> Get a list of supported protection plugin masks.static Region[]
getRegions
(Player player) Get a player's allowed WorldEdit region(s).static Region[]
getRegions
(Player player, FaweMaskManager.MaskType type, boolean isWhiteList) Get a player's allowed WorldEdit region(s).static TaskManager
The TaskManager has some useful methods for doing things asynchronously.getTranslations
(Locale locale) static World
static boolean
Check if the server has more than the configured low memory threshold.static Clipboard
Deprecated, for removal: This API element is subject to removal in a future version.Opens streams that are not then closed.static URL
upload
(Clipboard clipboard, ClipboardFormat format) Upload the clipboard to the configured web interface.
-
Constructor Details
-
FaweAPI
public FaweAPI()
-
-
Method Details
-
getTaskManager
The TaskManager has some useful methods for doing things asynchronously.- Returns:
- TaskManager
-
createQueue
You can either use aIQueueExtent
or anEditSession
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 worldautoQueue
- If it should start dispatching before you close/flush it.- Returns:
- the queue extent
-
getWorld
-
upload
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
@Deprecated(forRemoval=true, since="2.11.1") public static Clipboard load(File file) throws IOException Deprecated, for removal: This API element is subject to removal in a future version.Opens streams that are not then closed. UseClipboardFormats.findByFile(File)
and its relevant methods to allow closing created streams/closing the reader (which will close the stream(s))Just forwards to ClipboardFormat.SCHEMATIC.load(file).- Parameters:
file
- the file to load- Returns:
- a clipboard containing the schematic
- Throws:
IOException
- See Also:
-
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
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 oftype
- Mask type; whether to check if the player is an owner of a member of the regionsisWhiteList
- 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
-
getChangeSetFromFile
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 ofDiskStorageHistory
objects.- Parameters:
origin
- - The origin locationuser
- - The uuid (may be null)radius
- - The radius from the origin of the edittimediff
- - The max age of the file in millisecondsshallow
- - If shallow is true, FAWE will only read the firstSettings.HISTORY.BUFFER_SIZE
bytes to obtain history info- Returns:
- a list of DiskStorageHistory Objects
-
getChangeSetFromDisk
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.- Removes all lighting, then relights.
- Relights in parallel (if enabled) for best performance.
- Resends the chunks to the client.
- Parameters:
world
- World to relight inselection
- Region to relightqueue
- Queue to relight in/frommode
- The mode to relight with- Returns:
- Chunks changed
-
addMemoryLimitedTask
Runs a task when the server is low on memory. -
addMemoryPlentifulTask
Runs a task when the server is no longer low on memory. -
getTranslations
-