Package com.fastasyncworldedit.core.util
Class MainUtil
java.lang.Object
com.fastasyncworldedit.core.util.MainUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkImageHost
(URI uri) static void
chunkTaskSync
(RegionWrapper region, RunnableVal<int[]> task) The int[] will be in the form: [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] and will represent the bottom and top parts of the chunkstatic byte[]
compress
(byte[] bytes, byte[] buffer, int level) static int
compress
(byte[] bytes, int length, byte[] buffer, OutputStream out, Deflater deflate) static File
static File
static File
static Object
static byte[]
decompress
(byte[] bytes, byte[] buffer, int length, int level) static void
deleteOlder
(File directory, long timeDiff, boolean printDebug) static void
static FaweInputStream
static FaweInputStream
getCompressedIS
(InputStream is, int buffer) static FaweOutputStream
getCompressedOS
(OutputStream os, int amount) static FaweOutputStream
getCompressedOS
(OutputStream os, int amount, int buffer) Note: The returned stream is not thread safe.static File
static File
static File
static File
getJarFile
(Class<?> clazz) static int
getMaxCompressedLength
(int size) static int
getMaxFileId
(File folder) static long
static String
static Thread[]
static long
getTotalSize
(Path path) static boolean
isInSubDirectory
(File dir, File file) static void
iterateFiles
(File directory, Consumer<File> task) static BufferedImage
static BufferedImage
readImage
(InputStream stream) static BufferedImage
static InputStream
readImageStream
(URI uri) static int[]
regionNameToCoords
(String fileName) static String
relativize
(String path) static File
resolve
(File dir, String filename, ClipboardFormat format, boolean allowDir) static File
resolveRelative
(File file) static String
secToTime
(long time) static CompoundTag
setEntityInfo
(CompoundTag tag, Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.static CompoundTag
setPosition
(CompoundTag tag, int x, int y, int z) Deprecated, for removal: This API element is subject to removal in a future version.static long
static BufferedImage
toRGB
(BufferedImage src) static void
traverse
(Path path, BiConsumer<Path, BasicFileAttributes> onEach) static URL
upload
(String urlStr, boolean save, String uuid, String file, String extension, RunnableVal<OutputStream> writeTask) static URL
upload
(UUID uuid, String file, String extension, RunnableVal<OutputStream> writeTask)
-
Constructor Details
-
MainUtil
public MainUtil()
-
-
Method Details
-
filter
-
getTotalSize
-
traverse
-
resolveRelative
-
relativize
-
getMaxFileId
-
getFile
-
getFile
-
getSize
-
getCompressedOS
- Throws:
IOException
-
getMaxCompressedLength
public static int getMaxCompressedLength(int size) -
compress
public static int compress(byte[] bytes, int length, byte[] buffer, OutputStream out, Deflater deflate) throws IOException - Throws:
IOException
-
compress
public static byte[] compress(byte[] bytes, byte[] buffer, int level) -
decompress
public static byte[] decompress(byte[] bytes, byte[] buffer, int length, int level) -
getCompressedOS
public static FaweOutputStream getCompressedOS(OutputStream os, int amount, int buffer) throws IOException Note: The returned stream is not thread safe.- Throws:
IOException
-
getCompressedIS
- Throws:
IOException
-
getCompressedIS
- Throws:
IOException
-
upload
public static URL upload(UUID uuid, String file, String extension, @Nonnull RunnableVal<OutputStream> writeTask) -
upload
public static URL upload(String urlStr, boolean save, String uuid, String file, String extension, @Nonnull RunnableVal<OutputStream> writeTask) -
setPosition
@Nonnull @Deprecated(forRemoval=true, since="2.11.2") public static CompoundTag setPosition(@Nonnull CompoundTag tag, int x, int y, int z) Deprecated, for removal: This API element is subject to removal in a future version.Create a copy of the tag and modify the (x, y, z) coordinates- Parameters:
tag
- Tag to copyx
- New X coordinatey
- New Y coordinatez
- New Z coordinate- Returns:
- New tag
-
setEntityInfo
@Nonnull @Deprecated(forRemoval=true, since="2.11.2") public static CompoundTag setEntityInfo(@Nonnull CompoundTag tag, @Nonnull Entity entity) Deprecated, for removal: This API element is subject to removal in a future version.useNbtUtils.withEntityInfo(LinCompoundTag, Entity)
insteadCreate a copy of the tag and modify the entity inf- Parameters:
tag
- Tag to copyentity
- Entity- Returns:
- New tag
-
getText
- Throws:
IOException
-
download
- Throws:
IOException
-
getJarFile
-
getJarFile
-
getThreads
-
copyFile
- Throws:
IOException
-
readImage
- Throws:
IOException
-
readImage
- Throws:
IOException
-
readImageStream
- Throws:
IOException
-
readImage
- Throws:
IOException
-
checkImageHost
- Throws:
IOException
-
toRGB
-
copyFile
-
copyFile
-
regionNameToCoords
-
resolve
public static File resolve(File dir, String filename, @Nullable ClipboardFormat format, boolean allowDir) -
isInSubDirectory
- Throws:
IOException
-
iterateFiles
-
chunkTaskSync
The int[] will be in the form: [chunkx, chunkz, pos1x, pos1z, pos2x, pos2z, isedge] and will represent the bottom and top parts of the chunk -
copyNd
-
secToTime
-
timeToSec
-
deleteOlder
-
NbtUtils.withEntityInfo(LinCompoundTag, Entity)
instead