Simplify flushing of clipboards in ClipboardCommands

This commit is contained in:
dordsor21 2021-09-13 15:07:16 +01:00
parent f641fc1716
commit 3088b1245c
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -169,7 +169,7 @@ public class ClipboardCommands {
} catch (Throwable e) {
throw e;
} finally {
saveDiskClipboard(clipboard);
clipboard.flush();
}
session.setClipboard(new ClipboardHolder(clipboard));
@ -306,7 +306,7 @@ public class ClipboardCommands {
} catch (Throwable e) {
throw e;
} finally {
saveDiskClipboard(clipboard);
clipboard.flush();
}
session.setClipboard(new ClipboardHolder(clipboard));
@ -465,19 +465,6 @@ public class ClipboardCommands {
actor.print(Caption.of("fawe.tips.tip.copypaste"));
}
}
private void saveDiskClipboard(Clipboard clipboard) {
DiskOptimizedClipboard c;
if (clipboard instanceof DiskOptimizedClipboard) {
c = (DiskOptimizedClipboard) clipboard;
} else if (clipboard instanceof BlockArrayClipboard
&& ((BlockArrayClipboard) clipboard).getParent() instanceof DiskOptimizedClipboard) {
c = (DiskOptimizedClipboard) ((BlockArrayClipboard) clipboard).getParent();
} else {
return;
}
c.flush();
}
//FAWE end
@Command(