Allow NBT stored in DiskOptimizedClipboards to be written to disk as a compressed byte array at the end of the file (#1745)

* Allow NBT stored in DiskOptimizedClipboards to be written to disk as a compressed byte array at the end of the file

* Add some deprecations/javadocs and provide the expected clipboard version on error

* Javadoc since tags and add location of clipboard folder to error

* Refactor load-from-file method into DOC class

* Refactor nbt loading code into separate method in DOC
This commit is contained in:
Jordan
2022-06-09 11:48:35 +01:00
committed by GitHub
parent af234b284b
commit 0b33fa8757
7 changed files with 406 additions and 25 deletions

View File

@ -470,13 +470,13 @@ public interface Player extends Entity, Actor {
}
} catch (EmptyClipboardException ignored) {
}
DiskOptimizedClipboard doc = new DiskOptimizedClipboard(file);
DiskOptimizedClipboard doc = DiskOptimizedClipboard.loadFromFile(file);
Clipboard clip = doc.toClipboard();
ClipboardHolder holder = new ClipboardHolder(clip);
session.setClipboard(holder);
}
} catch (FaweClipboardVersionMismatchException e) {
print(Caption.of("fawe.error.clipboard.on.disk.version.mismatch"));
print(e.getComponent());
} catch (RuntimeException e) {
print(Caption.of("fawe.error.clipboard.invalid"));
e.printStackTrace();