mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Add -n flag to //paste to select without pasting.
This commit is contained in:
parent
2b1a7ed943
commit
fc5c625f02
@ -140,6 +140,8 @@ public class ClipboardCommands {
|
|||||||
boolean atOrigin,
|
boolean atOrigin,
|
||||||
@Switch(name = 's', desc = "Select the region after pasting")
|
@Switch(name = 's', desc = "Select the region after pasting")
|
||||||
boolean selectPasted,
|
boolean selectPasted,
|
||||||
|
@Switch(name = 'n', desc = "No paste, select only. (Implies -s)")
|
||||||
|
boolean onlySelect,
|
||||||
@Switch(name = 'e', desc = "Paste entities if available")
|
@Switch(name = 'e', desc = "Paste entities if available")
|
||||||
boolean pasteEntities,
|
boolean pasteEntities,
|
||||||
@Switch(name = 'b', desc = "Paste biomes if available")
|
@Switch(name = 'b', desc = "Paste biomes if available")
|
||||||
@ -151,19 +153,23 @@ public class ClipboardCommands {
|
|||||||
ClipboardHolder holder = session.getClipboard();
|
ClipboardHolder holder = session.getClipboard();
|
||||||
Clipboard clipboard = holder.getClipboard();
|
Clipboard clipboard = holder.getClipboard();
|
||||||
Region region = clipboard.getRegion();
|
Region region = clipboard.getRegion();
|
||||||
|
List<String> messages = Lists.newArrayList();
|
||||||
|
|
||||||
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(actor);
|
BlockVector3 to = atOrigin ? clipboard.getOrigin() : session.getPlacementPosition(actor);
|
||||||
Operation operation = holder
|
if (!onlySelect) {
|
||||||
.createPaste(editSession)
|
Operation operation = holder
|
||||||
.to(to)
|
.createPaste(editSession)
|
||||||
.ignoreAirBlocks(ignoreAirBlocks)
|
.to(to)
|
||||||
.copyBiomes(pasteBiomes)
|
.ignoreAirBlocks(ignoreAirBlocks)
|
||||||
.copyEntities(pasteEntities)
|
.copyBiomes(pasteBiomes)
|
||||||
.maskSource(sourceMask)
|
.copyEntities(pasteEntities)
|
||||||
.build();
|
.maskSource(sourceMask)
|
||||||
Operations.completeLegacy(operation);
|
.build();
|
||||||
|
Operations.completeLegacy(operation);
|
||||||
|
operation.addStatusMessages(messages);
|
||||||
|
}
|
||||||
|
|
||||||
if (selectPasted) {
|
if (selectPasted || onlySelect) {
|
||||||
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
BlockVector3 clipboardOffset = clipboard.getRegion().getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
Vector3 realTo = to.toVector3().add(holder.getTransform().apply(clipboardOffset.toVector3()));
|
||||||
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
Vector3 max = realTo.add(holder.getTransform().apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
|
||||||
@ -173,9 +179,11 @@ public class ClipboardCommands {
|
|||||||
selector.explainRegionAdjust(actor, session);
|
selector.explainRegionAdjust(actor, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
actor.print("The clipboard has been pasted at " + to);
|
if (onlySelect) {
|
||||||
List<String> messages = Lists.newArrayList();
|
actor.print("Selected clipboard paste region.");
|
||||||
operation.addStatusMessages(messages);
|
} else {
|
||||||
|
actor.print("The clipboard has been pasted at " + to);
|
||||||
|
}
|
||||||
messages.forEach(actor::print);
|
messages.forEach(actor::print);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user