3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02:50:06 +01:00

only close clipboard on error during copy

apply to //cut as well
Dieser Commit ist enthalten in:
dordsor21 2021-09-11 00:27:26 +01:00
Ursprung 470ba64fe4
Commit db24b429c1
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -139,8 +139,8 @@ public class ClipboardCommands {
} }
session.setClipboard(null); session.setClipboard(null);
try (Clipboard clipboard = new BlockArrayClipboard(region, actor.getUniqueId())) { Clipboard clipboard = new BlockArrayClipboard(region, actor.getUniqueId());
try {
clipboard.setOrigin(centerClipboard ? region.getCenter().toBlockPoint() : session.getPlacementPosition(actor)); clipboard.setOrigin(centerClipboard ? region.getCenter().toBlockPoint() : session.getPlacementPosition(actor));
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
copy.setCopyingEntities(copyEntities); copy.setCopyingEntities(copyEntities);
@ -170,6 +170,9 @@ public class ClipboardCommands {
session.setClipboard(new ClipboardHolder(clipboard)); session.setClipboard(new ClipboardHolder(clipboard));
copy.getStatusMessages().forEach(actor::print); copy.getStatusMessages().forEach(actor::print);
} catch (Throwable e) {
clipboard.close();
throw e;
} }
//FAWE end //FAWE end
} }
@ -274,6 +277,7 @@ public class ClipboardCommands {
session.setClipboard(null); session.setClipboard(null);
BlockArrayClipboard clipboard = new BlockArrayClipboard(region, actor.getUniqueId()); BlockArrayClipboard clipboard = new BlockArrayClipboard(region, actor.getUniqueId());
try {
clipboard.setOrigin(session.getPlacementPosition(actor)); clipboard.setOrigin(session.getPlacementPosition(actor));
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
copy.setSourceFunction(new BlockReplace(editSession, leavePattern)); copy.setSourceFunction(new BlockReplace(editSession, leavePattern));
@ -306,6 +310,10 @@ public class ClipboardCommands {
actor.print(Caption.of("fawe.tips.tip.lazycut")); actor.print(Caption.of("fawe.tips.tip.lazycut"));
} }
copy.getStatusMessages().forEach(actor::print); copy.getStatusMessages().forEach(actor::print);
} catch (Throwable e) {
clipboard.close();
throw e;
}
//FAWE end //FAWE end
} }