mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
only close clipboard on error during copy
apply to //cut as well
This commit is contained in:
parent
470ba64fe4
commit
db24b429c1
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user