use of com.fastasyncworldedit.core.internal.exception.FaweClipboardVersionMismatchException in project FastAsyncWorldEdit by IntellectualSites.
the class DiskOptimizedClipboard method readSize.
private static BlockVector3 readSize(File file) {
try (DataInputStream is = new DataInputStream(new FileInputStream(file))) {
is.skipBytes(2);
int version = is.readChar();
if (version != VERSION) {
throw new FaweClipboardVersionMismatchException();
}
return BlockVector3.at(is.readChar(), is.readChar(), is.readChar());
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
use of com.fastasyncworldedit.core.internal.exception.FaweClipboardVersionMismatchException in project FastAsyncWorldEdit by IntellectualSites.
the class Player method loadClipboardFromDisk.
/**
* Loads any history items from disk: - Should already be called if history on disk is enabled.
*/
default void loadClipboardFromDisk() {
File file = MainUtil.getFile(Fawe.platform().getDirectory(), Settings.settings().PATHS.CLIPBOARD + File.separator + getUniqueId() + ".bd");
try {
if (file.exists() && file.length() > 5) {
LocalSession session = getSession();
try {
if (session.getClipboard() != null) {
return;
}
} catch (EmptyClipboardException ignored) {
}
DiskOptimizedClipboard doc = new DiskOptimizedClipboard(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"));
} catch (RuntimeException e) {
print(Caption.of("fawe.error.clipboard.invalid"));
e.printStackTrace();
print(Caption.of("fawe.error.stacktrace"));
print(Caption.of("fawe.error.clipboard.load.failure"));
print(Caption.of("fawe.error.clipboard.invalid.info", file.getName(), file.length()));
print(Caption.of("fawe.error.stacktrace"));
} catch (Exception e) {
print(Caption.of("fawe.error.clipboard.invalid"));
e.printStackTrace();
print(Caption.of("fawe.error.stacktrace"));
print(Caption.of("fawe.error.no-failure"));
print(Caption.of("fawe.error.clipboard.invalid.info", file.getName(), file.length()));
print(Caption.of("fawe.error.stacktrace"));
}
}
Aggregations