mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-11-26 04:36:16 +01:00
Updated Clipboard API (markdown)
parent
0c0e21babc
commit
3eaa0229d8
@ -1,38 +1,25 @@
|
||||
With FAWE installed, you can register a new ClipboardFormat through the API
|
||||
```Java
|
||||
ClipboardFormat.addFormat(new AbstractClipboardFormat("FAWE", "fawe") {
|
||||
ClipboardFormat.addFormat(new AbstractClipboardFormat("CUSTOM", "custom") { // name of format, aliases...
|
||||
@Override
|
||||
public ClipboardReader getReader(InputStream inputStream) throws IOException {
|
||||
return new FaweFormat(MainUtil.getCompressedIS(inputStream));
|
||||
return new yourCustomClipboardReader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClipboardWriter getWriter(OutputStream outputStream) throws IOException {
|
||||
return getWriter(outputStream, 8);
|
||||
return new yourCustomClipboardWriter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFormat(File file) {
|
||||
return file.getName().endsWith(".fawe") || file.getName().endsWith(".bd");
|
||||
// Return true if this file is using the format (usually just check the extension)
|
||||
return file.getName().endsWith(".custom");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExtension() {
|
||||
return "fawe";
|
||||
}
|
||||
|
||||
public ClipboardWriter getWriter(OutputStream os, int compression) throws IOException {
|
||||
FaweFormat writer = new FaweFormat(new FaweOutputStream(os));
|
||||
writer.compress(compression);
|
||||
return writer;
|
||||
}
|
||||
|
||||
public DiskOptimizedClipboard getUncompressedReadWrite(File file) throws IOException {
|
||||
return new DiskOptimizedClipboard(file);
|
||||
}
|
||||
|
||||
public DiskOptimizedClipboard createUncompressedReadWrite(int width, int height, int length, File file) {
|
||||
return new DiskOptimizedClipboard(width, height, length, file);
|
||||
return "custom";
|
||||
}
|
||||
});
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user