Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-26 02:50:06 +01:00
Refactor the try-catch for copy/cut commands, switch to saveDiskClipboard
instead of closing the clipboard on error
Address #1291
Dieser Commit ist enthalten in:
Ursprung
adf83bdd0a
Commit
fcbbc72a19
@ -140,7 +140,6 @@ public class ClipboardCommands {
|
|||||||
session.setClipboard(null);
|
session.setClipboard(null);
|
||||||
|
|
||||||
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);
|
||||||
@ -165,15 +164,16 @@ public class ClipboardCommands {
|
|||||||
editSession.setSourceMask(null);
|
editSession.setSourceMask(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
Operations.completeLegacy(copy);
|
Operations.completeLegacy(copy);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
saveDiskClipboard(clipboard);
|
saveDiskClipboard(clipboard);
|
||||||
|
}
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +277,6 @@ 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));
|
||||||
@ -302,18 +301,19 @@ public class ClipboardCommands {
|
|||||||
new MaskTraverser(sourceMask).reset(editSession);
|
new MaskTraverser(sourceMask).reset(editSession);
|
||||||
editSession.setSourceMask(null);
|
editSession.setSourceMask(null);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
Operations.completeLegacy(copy);
|
Operations.completeLegacy(copy);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
saveDiskClipboard(clipboard);
|
saveDiskClipboard(clipboard);
|
||||||
|
}
|
||||||
session.setClipboard(new ClipboardHolder(clipboard));
|
session.setClipboard(new ClipboardHolder(clipboard));
|
||||||
|
|
||||||
if (!actor.hasPermission("fawe.tips")) {
|
if (!actor.hasPermission("fawe.tips")) {
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren