mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-16 03:14:04 +00:00
Javadoc and Formatting fixes. (#619)
Javadoc and Formatting fixes. Also, extremely minor code changes which have been tested. This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. * Updated PlotSquared URL * Removed plugin acronyms * Fixed a typo * Fixed grammar * Use modern block id's * Update YouTube video URL
This commit is contained in:
@@ -62,12 +62,12 @@ import static org.enginehub.piston.part.CommandParts.arg;
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class ApplyBrushCommands {
|
||||
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape") , TranslatableComponent.of("worldedit.brush.apply.shape"))
|
||||
private static final CommandArgument REGION_FACTORY = arg(TranslatableComponent.of("shape"), TranslatableComponent.of("worldedit.brush.apply.shape"))
|
||||
.defaultsTo(ImmutableList.of())
|
||||
.ofTypes(ImmutableList.of(Key.of(RegionFactory.class)))
|
||||
.build();
|
||||
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius") , TranslatableComponent.of("worldedit.brush.apply.radius"))
|
||||
private static final CommandArgument RADIUS = arg(TranslatableComponent.of("radius"), TranslatableComponent.of("worldedit.brush.apply.radius"))
|
||||
.defaultsTo(ImmutableList.of("5"))
|
||||
.ofTypes(ImmutableList.of(Key.of(double.class)))
|
||||
.build();
|
||||
@@ -86,7 +86,7 @@ public class ApplyBrushCommands {
|
||||
|
||||
builder.condition(new PermissionCondition(ImmutableSet.of("worldedit.brush.apply")));
|
||||
builder.addParts(REGION_FACTORY, RADIUS);
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type") , TranslatableComponent.of("worldedit.brush.apply.type"))
|
||||
builder.addPart(SubCommandPart.builder(TranslatableComponent.of("type"), TranslatableComponent.of("worldedit.brush.apply.type"))
|
||||
.withCommands(manager.getAllCommands().collect(Collectors.toList()))
|
||||
.required()
|
||||
.build());
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -133,7 +133,7 @@ public class ClipboardCommands {
|
||||
session.setClipboard(null);
|
||||
|
||||
Clipboard clipboard = new BlockArrayClipboard(region, actor.getUniqueId());
|
||||
|
||||
|
||||
clipboard.setOrigin(centerClipboard ? region.getCenter().toBlockPoint() : session.getPlacementPosition(actor));
|
||||
ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint());
|
||||
copy.setCopyingEntities(copyEntities);
|
||||
@@ -156,16 +156,15 @@ public class ClipboardCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/lazycopy",
|
||||
desc = "Lazily copy the selection to the clipboard"
|
||||
name = "/lazycopy",
|
||||
desc = "Lazily copy the selection to the clipboard"
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.lazycopy")
|
||||
public void lazyCopy(Actor actor, LocalSession session, EditSession editSession,
|
||||
@Selection Region region,
|
||||
public void lazyCopy(Actor actor, LocalSession session, EditSession editSession, @Selection Region region,
|
||||
@Switch(name = 'e', desc = "Skip copy entities")
|
||||
boolean skipEntities,
|
||||
boolean skipEntities,
|
||||
@Switch(name = 'b', desc = "Also copy biomes")
|
||||
boolean copyBiomes) throws WorldEditException {
|
||||
boolean copyBiomes) throws WorldEditException {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
@@ -178,39 +177,40 @@ public class ClipboardCommands {
|
||||
|
||||
lazyClipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
session.setClipboard(new ClipboardHolder(lazyClipboard));
|
||||
actor.print(Caption.of("fawe.worldedit.copy.command.copy" , region.getVolume()));
|
||||
actor.print(Caption.of("fawe.worldedit.copy.command.copy", region.getVolume()));
|
||||
}
|
||||
|
||||
// @Command(
|
||||
// name = "/lazycut",
|
||||
// desc = "Lazily cut the selection to the clipboard"
|
||||
// )
|
||||
// @CommandPermissions("worldedit.clipboard.lazycut")
|
||||
// public void lazyCut(Actor actor, LocalSession session, EditSession editSession,
|
||||
// @Selection final Region region,
|
||||
// @Switch(name = 'e', desc = "Skip copy entities")
|
||||
// boolean skipEntities,
|
||||
// @ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "")
|
||||
// Mask maskOpt,
|
||||
// @Switch(name = 'b', desc = "Also copy biomes")
|
||||
// boolean copyBiomes) throws WorldEditException {
|
||||
// BlockVector3 min = region.getMinimumPoint();
|
||||
// BlockVector3 max = region.getMaximumPoint();
|
||||
// long volume = ((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
|
||||
// FaweLimit limit = actor.getLimit();
|
||||
// if (volume >= limit.MAX_CHECKS) {
|
||||
// throw FaweCache.MAX_CHECKS;
|
||||
// }
|
||||
// if (volume >= limit.MAX_CHANGES) {
|
||||
// throw FaweCache.MAX_CHANGES;
|
||||
// }
|
||||
// session.setClipboard(null);
|
||||
//
|
||||
// ReadOnlyClipboard lazyClipboard = new WorldCutClipboard(editSession, region, !skipEntities, copyBiomes);
|
||||
// clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
// session.setClipboard(new ClipboardHolder(lazyClipboard));
|
||||
// actor.print(TranslatableComponent.of("fawe.worldedit.cut.command.cut.lazy" , region.getArea()));
|
||||
// }
|
||||
/*
|
||||
@Command(
|
||||
name = "/lazycut",
|
||||
desc = "Lazily cut the selection to the clipboard"
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.lazycut")
|
||||
public void lazyCut(Actor actor, LocalSession session, EditSession editSession,
|
||||
@Selection final Region region,
|
||||
@Switch(name = 'e', desc = "Skip copy entities")
|
||||
boolean skipEntities,
|
||||
@ArgFlag(name = 'm', desc = "Set the exclude mask, matching blocks become air", def = "")
|
||||
Mask maskOpt,
|
||||
@Switch(name = 'b', desc = "Also copy biomes")
|
||||
boolean copyBiomes) throws WorldEditException {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = ((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1);
|
||||
FaweLimit limit = actor.getLimit();
|
||||
if (volume >= limit.MAX_CHECKS) {
|
||||
throw FaweCache.MAX_CHECKS;
|
||||
}
|
||||
if (volume >= limit.MAX_CHANGES) {
|
||||
throw FaweCache.MAX_CHANGES;
|
||||
}
|
||||
session.setClipboard(null);
|
||||
|
||||
ReadOnlyClipboard lazyClipboard = new WorldCutClipboard(editSession, region, !skipEntities, copyBiomes);
|
||||
clipboard.setOrigin(session.getPlacementPosition(actor));
|
||||
session.setClipboard(new ClipboardHolder(lazyClipboard));
|
||||
actor.print(TranslatableComponent.of("fawe.worldedit.cut.command.cut.lazy", region.getArea()));
|
||||
}*/
|
||||
|
||||
@Command(
|
||||
name = "/cut",
|
||||
@@ -267,24 +267,24 @@ public class ClipboardCommands {
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
actor.print(TranslatableComponent.of("fawe.tips.tip.lazycut"));
|
||||
}
|
||||
copy.getStatusMessages().forEach(actor::print);
|
||||
copy.getStatusMessages().forEach(actor::print);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "download",
|
||||
aliases = { "/download" },
|
||||
desc = "Downloads your clipboard through the configured web interface"
|
||||
name = "download",
|
||||
aliases = { "/download" },
|
||||
desc = "Downloads your clipboard through the configured web interface"
|
||||
)
|
||||
@Deprecated
|
||||
@CommandPermissions({"worldedit.clipboard.download"})
|
||||
public void download(final Player player, final LocalSession session, @Arg(name = "format", desc = "String", def = "schem") final String formatName) throws WorldEditException {
|
||||
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
|
||||
if (format == null) {
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format" , formatName));
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format", formatName));
|
||||
return;
|
||||
}
|
||||
|
||||
player.print(Caption.of("fawe.web.generating.link" , formatName));
|
||||
player.print(Caption.of("fawe.web.generating.link", formatName));
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
|
||||
URL url;
|
||||
@@ -370,7 +370,7 @@ public class ClipboardCommands {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
player.print(Caption.of("fawe.web.download.link" , urlText).clickEvent(ClickEvent.openUrl(urlText)));
|
||||
player.print(Caption.of("fawe.web.download.link", urlText).clickEvent(ClickEvent.openUrl(urlText)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,9 +412,13 @@ public class ClipboardCommands {
|
||||
checkPaste(actor, editSession, to, holder, clipboard);
|
||||
|
||||
if (!onlySelect) {
|
||||
Operation operation =
|
||||
holder.createPaste(editSession).to(to).ignoreAirBlocks(ignoreAirBlocks)
|
||||
.copyBiomes(pasteBiomes).copyEntities(pasteEntities).maskSource(sourceMask)
|
||||
Operation operation = holder
|
||||
.createPaste(editSession)
|
||||
.to(to)
|
||||
.ignoreAirBlocks(ignoreAirBlocks)
|
||||
.copyBiomes(pasteBiomes)
|
||||
.copyEntities(pasteEntities)
|
||||
.maskSource(sourceMask)
|
||||
.build();
|
||||
Operations.completeLegacy(operation);
|
||||
messages.addAll(Lists.newArrayList(operation.getStatusMessages()));
|
||||
@@ -451,23 +455,22 @@ public class ClipboardCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/place",
|
||||
desc = "Place the clipboard's contents without applying transformations (e.g. rotate)"
|
||||
)
|
||||
|
||||
name = "/place",
|
||||
desc = "Place the clipboard's contents without applying transformations (e.g. rotate)"
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.place")
|
||||
@Logging(PLACEMENT)
|
||||
public void place(Actor actor, World world, LocalSession session, final EditSession editSession,
|
||||
@Switch(name = 'a', desc = "Skip air blocks")
|
||||
boolean ignoreAirBlocks,
|
||||
boolean ignoreAirBlocks,
|
||||
@Switch(name = 'o', desc = "Paste at the original position")
|
||||
boolean atOrigin,
|
||||
boolean atOrigin,
|
||||
@Switch(name = 's', desc = "Select the region after pasting")
|
||||
boolean selectPasted,
|
||||
boolean selectPasted,
|
||||
@Switch(name = 'e', desc = "Paste entities if available")
|
||||
boolean pasteEntities,
|
||||
boolean pasteEntities,
|
||||
@Switch(name = 'b', desc = "Paste biomes if available")
|
||||
boolean pasteBiomes) throws WorldEditException {
|
||||
boolean pasteBiomes) throws WorldEditException {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
final Clipboard clipboard = holder.getClipboard();
|
||||
final BlockVector3 origin = clipboard.getOrigin();
|
||||
@@ -486,7 +489,7 @@ public class ClipboardCommands {
|
||||
selector.learnChanges();
|
||||
selector.explainRegionAdjust(actor, session);
|
||||
}
|
||||
actor.print(Caption.of("fawe.worldedit.paste.command.paste" , to));
|
||||
actor.print(Caption.of("fawe.worldedit.paste.command.paste", to));
|
||||
|
||||
if (!actor.hasPermission("fawe.tips")) {
|
||||
actor.print(TranslatableComponent.of("fawe.tips.tip.copypaste"));
|
||||
@@ -496,23 +499,23 @@ public class ClipboardCommands {
|
||||
@Command(
|
||||
name = "/rotate",
|
||||
desc = "Rotate the contents of the clipboard",
|
||||
descFooter = "Non-destructively rotate the contents of the clipboard.\n" +
|
||||
"Angles are provided in degrees and a positive angle will result in a clockwise rotation. " +
|
||||
"Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n"
|
||||
descFooter = "Non-destructively rotate the contents of the clipboard.\n"
|
||||
+ "Angles are provided in degrees and a positive angle will result in a clockwise rotation. "
|
||||
+ "Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.clipboard.rotate")
|
||||
public void rotate(Actor actor, LocalSession session,
|
||||
@Arg(desc = "Amount to rotate on the y-axis")
|
||||
double yRotate,
|
||||
double rotateY,
|
||||
@Arg(desc = "Amount to rotate on the x-axis", def = "0")
|
||||
double xRotate,
|
||||
double rotateX,
|
||||
@Arg(desc = "Amount to rotate on the z-axis", def = "0")
|
||||
double zRotate) throws WorldEditException {
|
||||
double rotateZ) throws WorldEditException {
|
||||
ClipboardHolder holder = session.getClipboard();
|
||||
AffineTransform transform = new AffineTransform();
|
||||
transform = transform.rotateY(-yRotate);
|
||||
transform = transform.rotateX(-xRotate);
|
||||
transform = transform.rotateZ(-zRotate);
|
||||
transform = transform.rotateY(-rotateY);
|
||||
transform = transform.rotateX(-rotateX);
|
||||
transform = transform.rotateZ(-rotateZ);
|
||||
holder.setTransform(holder.getTransform().combine(transform));
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.rotate.rotated"));
|
||||
}
|
||||
|
@@ -113,7 +113,9 @@ public class FlattenedClipboardTransform {
|
||||
*/
|
||||
public Operation copyTo(Extent target) {
|
||||
Extent extent = original;
|
||||
if (transform != null && !transform.isIdentity()) extent = new BlockTransformExtent(original, transform);
|
||||
if (transform != null && !transform.isIdentity()) {
|
||||
extent = new BlockTransformExtent(original, transform);
|
||||
}
|
||||
ForwardExtentCopy copy = new ForwardExtentCopy(extent, original.getRegion(), original.getOrigin(), target, original.getOrigin());
|
||||
copy.setTransform(transform);
|
||||
if (original.hasBiomes()) {
|
||||
|
@@ -409,12 +409,18 @@ public class GeneralCommands {
|
||||
// complexity
|
||||
int min = Integer.parseInt(arguments.get(0));
|
||||
int max = Integer.parseInt(arguments.get(1));
|
||||
if (min < 0 || max > 100) throw new InputParseException("Complexity must be in the range 0-100");
|
||||
if (min != 0 || max != 100) util = new CleanTextureUtil(util, min, max);
|
||||
if (min < 0 || max > 100) {
|
||||
throw new InputParseException("Complexity must be in the range 0-100");
|
||||
}
|
||||
if (min != 0 || max != 100) {
|
||||
util = new CleanTextureUtil(util, min, max);
|
||||
}
|
||||
|
||||
randomIndex = 2;
|
||||
} else if (arguments.size() == 1 && argLower.equals("true") || argLower.equals("false")) {
|
||||
if (argLower.equals("true")) util = new RandomTextureUtil(util);
|
||||
if (argLower.equals("true")) {
|
||||
util = new RandomTextureUtil(util);
|
||||
}
|
||||
checkRandomization = false;
|
||||
} else {
|
||||
if (argLower.equals("#copy") || argLower.equals("#clipboard")) {
|
||||
@@ -435,20 +441,24 @@ public class GeneralCommands {
|
||||
if (checkRandomization) {
|
||||
if (arguments.size() > randomIndex) {
|
||||
boolean random = Boolean.parseBoolean(arguments.get(randomIndex));
|
||||
if (random) util = new RandomTextureUtil(util);
|
||||
if (random) {
|
||||
util = new RandomTextureUtil(util);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(util instanceof CachedTextureUtil)) util = new CachedTextureUtil(util);
|
||||
if (!(util instanceof CachedTextureUtil)) {
|
||||
util = new CachedTextureUtil(util);
|
||||
}
|
||||
session.setTextureUtil(util);
|
||||
player.print(Caption.of("fawe.worldedit.general.texture.set" , StringMan.join(arguments, " ")));
|
||||
player.print(Caption.of("fawe.worldedit.general.texture.set", StringMan.join(arguments, " ")));
|
||||
}
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/gsmask",
|
||||
aliases = {"gsmask", "globalsourcemask", "/globalsourcemask"},
|
||||
desc = "Set the global source mask",
|
||||
descFooter = "The global source mask applies to all edits you do and masks based on the source blocks (e.g., the blocks in your clipboard)"
|
||||
name = "/gsmask",
|
||||
aliases = {"gsmask", "globalsourcemask", "/globalsourcemask"},
|
||||
desc = "Set the global source mask",
|
||||
descFooter = "The global source mask applies to all edits you do and masks based on the source blocks (e.g., the blocks in your clipboard)"
|
||||
)
|
||||
@CommandPermissions({"worldedit.global-mask", "worldedit.mask.global"})
|
||||
public void gsmask(Player player, LocalSession session, EditSession editSession, @Arg(desc = "The mask to set", def = "") Mask maskOpt) throws WorldEditException {
|
||||
@@ -462,9 +472,9 @@ public class GeneralCommands {
|
||||
|
||||
|
||||
@Command(
|
||||
name = "/gtransform",
|
||||
aliases = {"gtransform"},
|
||||
desc = "Set the global transform"
|
||||
name = "/gtransform",
|
||||
aliases = {"gtransform"},
|
||||
desc = "Set the global transform"
|
||||
)
|
||||
@CommandPermissions({"worldedit.global-transform", "worldedit.transform.global"})
|
||||
public void gtransform(Player player, EditSession editSession, LocalSession session, ResettableExtent transform) throws WorldEditException {
|
||||
@@ -477,9 +487,9 @@ public class GeneralCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/tips",
|
||||
aliases = {"tips"},
|
||||
desc = "Toggle FAWE tips"
|
||||
name = "/tips",
|
||||
aliases = {"tips"},
|
||||
desc = "Toggle FAWE tips"
|
||||
)
|
||||
@CommandPermissions("fawe.tips")
|
||||
public void tips(Player player, LocalSession session) throws WorldEditException {
|
||||
|
@@ -108,26 +108,26 @@ public class GenerationCommands {
|
||||
@Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMaxOpt) throws WorldEditException {
|
||||
CavesGen gen = new CavesGen(sizeOpt, frequencyOpt, rarityOpt, minYOpt, maxYOpt, systemFrequencyOpt, individualRarityOpt, pocketChanceOpt, pocketMinOpt, pocketMaxOpt);
|
||||
editSession.generate(region, gen);
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount()));
|
||||
}
|
||||
|
||||
|
||||
@Command(
|
||||
name = "/ores",
|
||||
desc = "Generates ores"
|
||||
name = "/ores",
|
||||
desc = "Generates ores"
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.ore")
|
||||
@Logging(PLACEMENT)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void ores(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "Mask") Mask mask) throws WorldEditException {
|
||||
editSession.addOres(region, mask);
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/img",
|
||||
aliases = { "/image", "image" },
|
||||
desc = "Generate an image"
|
||||
name = "/img",
|
||||
aliases = { "/image", "image" },
|
||||
desc = "Generate an image"
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.image")
|
||||
@Logging(PLACEMENT)
|
||||
@@ -155,7 +155,9 @@ public class GenerationCommands {
|
||||
int color = finalImage.getRGB(x, z);
|
||||
BlockType block = tu.getNearestBlock(color);
|
||||
count[0]++;
|
||||
if (block != null) return editSession.setBlock(pos, block.getDefaultState());
|
||||
if (block != null) {
|
||||
return editSession.setBlock(pos, block.getDefaultState());
|
||||
}
|
||||
return false;
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
@@ -163,19 +165,19 @@ public class GenerationCommands {
|
||||
return false;
|
||||
});
|
||||
Operations.completeBlindly(visitor);
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/ore",
|
||||
desc = "Generates ores"
|
||||
name = "/ore",
|
||||
desc = "Generates ores"
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.ore")
|
||||
@Logging(PLACEMENT)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void ore(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "Mask") Mask mask, @Arg(desc = "Pattern") Pattern material, @Arg(desc="Ore vein size") @Range(from = 0, to=Integer.MAX_VALUE) int size, int freq, @Range(from=0, to=100) int rarity, @Range(from=0, to=255) int minY, @Range(from=0, to=255) int maxY) throws WorldEditException {
|
||||
editSession.addOre(region, mask, material, size, freq, rarity, minY, maxY);
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
|
||||
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount()));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@@ -211,7 +213,8 @@ public class GenerationCommands {
|
||||
int height,
|
||||
@Switch(name = 'h', desc = "Make a hollow cylinder")
|
||||
boolean hollow) throws WorldEditException {
|
||||
final double radiusX, radiusZ;
|
||||
final double radiusX;
|
||||
final double radiusZ;
|
||||
switch (radii.size()) {
|
||||
case 1:
|
||||
radiusX = radiusZ = Math.max(1, radii.get(0));
|
||||
@@ -270,7 +273,9 @@ public class GenerationCommands {
|
||||
boolean raised,
|
||||
@Switch(name = 'h', desc = "Make a hollow sphere")
|
||||
boolean hollow) throws WorldEditException {
|
||||
final double radiusX, radiusY, radiusZ;
|
||||
final double radiusX;
|
||||
final double radiusY;
|
||||
final double radiusZ;
|
||||
switch (radii.size()) {
|
||||
case 1:
|
||||
radiusX = radiusY = radiusZ = Math.max(0, radii.get(0));
|
||||
@@ -427,9 +432,15 @@ public class GenerationCommands {
|
||||
zero = max.add(min).multiply(0.5);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
if (unit.getX() == 0) {
|
||||
unit = unit.withX(1.0);
|
||||
}
|
||||
if (unit.getY() == 0) {
|
||||
unit = unit.withY(1.0);
|
||||
}
|
||||
if (unit.getZ() == 0) {
|
||||
unit = unit.withZ(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
@@ -451,9 +462,9 @@ public class GenerationCommands {
|
||||
name = "/generatebiome",
|
||||
aliases = { "/genbiome", "/gb" },
|
||||
desc = "Sets biome according to a formula.",
|
||||
descFooter = "Formula must return positive numbers (true) if the point is inside the shape\n" +
|
||||
"Sets the biome of blocks in that shape.\n"
|
||||
+"See also https://tinyurl.com/weexpr."
|
||||
descFooter = "Formula must return positive numbers (true) if the point is inside the shape\n"
|
||||
+ "Sets the biome of blocks in that shape.\n"
|
||||
+ "See also https://tinyurl.com/weexpr."
|
||||
)
|
||||
@CommandPermissions("worldedit.generation.shape.biome")
|
||||
@Logging(ALL)
|
||||
@@ -494,9 +505,15 @@ public class GenerationCommands {
|
||||
zero = max.add(min).multiply(0.5);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
if (unit.getX() == 0) {
|
||||
unit = unit.withX(1.0);
|
||||
}
|
||||
if (unit.getY() == 0) {
|
||||
unit = unit.withY(1.0);
|
||||
}
|
||||
if (unit.getZ() == 0) {
|
||||
unit = unit.withZ(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
|
@@ -70,50 +70,62 @@ public class HistorySubCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "restore",
|
||||
aliases = {"rerun"},
|
||||
desc = "Rerun edits" +
|
||||
" - The time uses s, m, h, d, y.\n" +
|
||||
" - Import from disk: /history import"
|
||||
name = "restore",
|
||||
aliases = {"rerun"},
|
||||
desc = "Rerun edits"
|
||||
+ " - The time uses s, m, h, d, y.\n"
|
||||
+ " - Import from disk: /history import"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.redo")
|
||||
@Confirm
|
||||
public synchronized void rerun(Player player, World world, RollbackDatabase database,
|
||||
@AllowedRegion Region[] allowedRegions,
|
||||
@ArgFlag(name = 'u', desc = "String user", def="me") UUID other,
|
||||
@ArgFlag(name = 'u', desc = "String user", def = "me")
|
||||
UUID other,
|
||||
@ArgFlag(name = 'r', def = "0", desc = "radius")
|
||||
@Range(from = 0, to = Integer.MAX_VALUE) int radius,
|
||||
@Range(from = 0, to = Integer.MAX_VALUE)
|
||||
int radius,
|
||||
@ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0")
|
||||
@Time long timeDiff) throws WorldEditException {
|
||||
@Time
|
||||
long timeDiff) throws WorldEditException {
|
||||
rollback(player, world, database, allowedRegions, other, radius, timeDiff, true);
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "rollback",
|
||||
desc = "Undo a specific edit. " +
|
||||
" - The time uses s, m, h, d, y."
|
||||
name = "rollback",
|
||||
desc = "Undo a specific edit. "
|
||||
+ " - The time uses s, m, h, d, y."
|
||||
)
|
||||
@CommandPermissions("worldedit.history.undo")
|
||||
@Confirm
|
||||
public synchronized void rollback(Player player, World world, RollbackDatabase database,
|
||||
@AllowedRegion Region[] allowedRegions,
|
||||
@ArgFlag(name = 'u', desc = "String user", def = "") UUID other,
|
||||
@ArgFlag(name = 'u', desc = "String user", def = "")
|
||||
UUID other,
|
||||
@ArgFlag(name = 'r', def = "0", desc = "radius")
|
||||
@Range(from = 0, to = Integer.MAX_VALUE) int radius,
|
||||
@ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0") @Time long timeDiff,
|
||||
@Switch(name = 'f', desc = "Restore instead of rollback") boolean restore) throws WorldEditException {
|
||||
@Range(from = 0, to = Integer.MAX_VALUE)
|
||||
int radius,
|
||||
@ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0")
|
||||
@Time
|
||||
long timeDiff,
|
||||
@Switch(name = 'f', desc = "Restore instead of rollback")
|
||||
boolean restore) throws WorldEditException {
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
player.print(Caption.of("fawe.error.setting.disable" , "history.use-database (Import with /history import )"));
|
||||
player.print(Caption.of("fawe.error.setting.disable", "history.use-database (Import with /history import )"));
|
||||
return;
|
||||
}
|
||||
checkCommandArgument(radius > 0, "Radius must be >= 0");
|
||||
checkCommandArgument(timeDiff > 0, "Time must be >= 0");
|
||||
|
||||
if (other == null) other = player.getUniqueId();
|
||||
if (other == null) {
|
||||
other = player.getUniqueId();
|
||||
}
|
||||
if (!other.equals(player.getUniqueId())) {
|
||||
player.checkPermission("worldedit.history.undo.other");
|
||||
}
|
||||
if (other == Identifiable.EVERYONE) other = null;
|
||||
if (other == Identifiable.EVERYONE) {
|
||||
other = null;
|
||||
}
|
||||
Location origin = player.getLocation();
|
||||
BlockVector3 bot = origin.toBlockPoint().subtract(radius, radius, radius);
|
||||
BlockVector3 top = origin.toBlockPoint().add(radius, radius, radius);
|
||||
@@ -121,11 +133,11 @@ public class HistorySubCommands {
|
||||
top = top.clampY(0, world.getMaxY());
|
||||
// TODO mask the regions bot / top to the bottom and top coord in the allowedRegions
|
||||
// TODO: then mask the edit to the bot / top
|
||||
// if (allowedRegions.length != 1 || !allowedRegions[0].isGlobal()) {
|
||||
// finalQueue = new MaskedIQueueExtent(SetQueue.IMP.getNewQueue(fp.getWorld(), true, false), allowedRegions);
|
||||
// } else {
|
||||
// finalQueue = SetQueue.IMP.getNewQueue(fp.getWorld(), true, false);
|
||||
// }
|
||||
// if (allowedRegions.length != 1 || !allowedRegions[0].isGlobal()) {
|
||||
// finalQueue = new MaskedIQueueExtent(SetQueue.IMP.getNewQueue(fp.getWorld(), true, false), allowedRegions);
|
||||
// } else {
|
||||
// finalQueue = SetQueue.IMP.getNewQueue(fp.getWorld(), true, false);
|
||||
// }
|
||||
int count = 0;
|
||||
UUID finalOther = other;
|
||||
long minTime = System.currentTimeMillis() - timeDiff;
|
||||
@@ -136,14 +148,14 @@ public class HistorySubCommands {
|
||||
String path = edit.getWorld().getName() + "/" + finalOther + "-" + edit.getIndex();
|
||||
player.print(Caption.of("fawe.worldedit.rollback.rollback.element", path));
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.tool.tool.inspect.info.footer" , count));
|
||||
player.print(Caption.of("fawe.worldedit.tool.tool.inspect.info.footer", count));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "import",
|
||||
desc = "Import history into the database" +
|
||||
" - The time uses s, m, h, d, y.\n" +
|
||||
" - Import from disk: /history import"
|
||||
name = "import",
|
||||
desc = "Import history into the database"
|
||||
+ " - The time uses s, m, h, d, y.\n"
|
||||
+ " - Import from disk: /history import"
|
||||
)
|
||||
@CommandPermissions("fawe.rollback.import")
|
||||
@Confirm
|
||||
@@ -197,14 +209,16 @@ public class HistorySubCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "info",
|
||||
aliases = {"summary", "summarize"},
|
||||
desc = "Summarize an edit"
|
||||
name = "info",
|
||||
aliases = {"summary", "summarize"},
|
||||
desc = "Summarize an edit"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.info")
|
||||
public synchronized void summary(Player player, RollbackDatabase database, Arguments arguments,
|
||||
@Arg(desc = "Player uuid/name") UUID other,
|
||||
@Arg(desc = "edit index") Integer index) throws WorldEditException, ExecutionException, InterruptedException {
|
||||
@Arg(desc = "Player uuid/name")
|
||||
UUID other,
|
||||
@Arg(desc = "edit index")
|
||||
Integer index) throws WorldEditException, ExecutionException, InterruptedException {
|
||||
RollbackOptimizedHistory edit = database.getEdit(other, index).get();
|
||||
if (edit == null) {
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.schematic.schematic.none"));
|
||||
@@ -238,11 +252,21 @@ public class HistorySubCommands {
|
||||
|
||||
String sizeStr = StringMan.humanReadableByteCountBin(edit.getSizeOnDisk());
|
||||
String extra = "";
|
||||
if (biomes) extra += "biomes, ";
|
||||
if (createdEnts) extra += "+entity, ";
|
||||
if (removedEnts) extra += "-entity, ";
|
||||
if (createdTiles) extra += "+tile, ";
|
||||
if (removedTiles) extra += "-tile, ";
|
||||
if (biomes) {
|
||||
extra += "biomes, ";
|
||||
}
|
||||
if (createdEnts) {
|
||||
extra += "+entity, ";
|
||||
}
|
||||
if (removedEnts) {
|
||||
extra += "-entity, ";
|
||||
}
|
||||
if (createdTiles) {
|
||||
extra += "+tile, ";
|
||||
}
|
||||
if (removedTiles) {
|
||||
extra += "-tile, ";
|
||||
}
|
||||
|
||||
TranslatableComponent body = Caption.of("fawe.worldedit.history.find.element.more", size, edit.getMinimumPoint(), edit.getMaximumPoint(), extra.trim(), sizeStr);
|
||||
Component distr = TextComponent.of("/history distr").clickEvent(ClickEvent.suggestCommand("//history distr " + other + " " + index));
|
||||
@@ -296,23 +320,29 @@ public class HistorySubCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "find",
|
||||
aliases = {"inspect", "search", "near"},
|
||||
desc = "Find nearby edits"
|
||||
name = "find",
|
||||
aliases = {"inspect", "search", "near"},
|
||||
desc = "Find nearby edits"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.find")
|
||||
public synchronized void find(Player player, World world, RollbackDatabase database, Arguments arguments,
|
||||
@ArgFlag(name = 'u', def="", desc = "String user") UUID other,
|
||||
@ArgFlag(name = 'u', def = "", desc = "String user")
|
||||
UUID other,
|
||||
@ArgFlag(name = 'r', def = "0", desc = "radius")
|
||||
@Range(from = 0, to = Integer.MAX_VALUE) Integer radius,
|
||||
@Range(from = 0, to = Integer.MAX_VALUE)
|
||||
Integer radius,
|
||||
@ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0")
|
||||
@Time Long timeDiff,
|
||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "") Integer page) throws WorldEditException {
|
||||
@Time
|
||||
Long timeDiff,
|
||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "")
|
||||
Integer page) throws WorldEditException {
|
||||
if (!Settings.IMP.HISTORY.USE_DATABASE) {
|
||||
player.print(Caption.of("fawe.error.setting.disable" , "history.use-database (Import with //history import )"));
|
||||
player.print(Caption.of("fawe.error.setting.disable", "history.use-database (Import with //history import )"));
|
||||
return;
|
||||
}
|
||||
if (other == null && radius == 0 && timeDiff == 0) throw new InsufficientArgumentsException("User must be provided");
|
||||
if (other == null && radius == 0 && timeDiff == 0) {
|
||||
throw new InsufficientArgumentsException("User must be provided");
|
||||
}
|
||||
checkCommandArgument(radius > 0, "Radius must be >= 0");
|
||||
checkCommandArgument(timeDiff > 0, "Time must be >= 0");
|
||||
|
||||
@@ -322,11 +352,15 @@ public class HistorySubCommands {
|
||||
List<Supplier<? extends ChangeSet>> history = cached == null ? null : cached.get();
|
||||
|
||||
if (page == null || history == null) {
|
||||
if (other == null) other = player.getUniqueId();
|
||||
if (other == null) {
|
||||
other = player.getUniqueId();
|
||||
}
|
||||
if (!other.equals(player.getUniqueId())) {
|
||||
player.checkPermission("worldedit.history.undo.other");
|
||||
}
|
||||
if (other == Identifiable.EVERYONE) other = null;
|
||||
if (other == Identifiable.EVERYONE) {
|
||||
other = null;
|
||||
}
|
||||
|
||||
BlockVector3 bot = origin.toBlockPoint().subtract(radius, radius, radius);
|
||||
BlockVector3 top = origin.toBlockPoint().add(radius, radius, radius);
|
||||
@@ -345,15 +379,18 @@ public class HistorySubCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "distr",
|
||||
aliases = {"distribution"},
|
||||
desc = "View block distribution for an edit"
|
||||
name = "distr",
|
||||
aliases = {"distribution"},
|
||||
desc = "View block distribution for an edit"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.distr")
|
||||
public void distr(Player player, LocalSession session, RollbackDatabase database, Arguments arguments,
|
||||
@Arg(desc = "Player uuid/name") UUID other,
|
||||
@Arg(desc = "edit index") Integer index,
|
||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "") Integer page) throws ExecutionException, InterruptedException {
|
||||
@Arg(desc = "Player uuid/name")
|
||||
UUID other,
|
||||
@Arg(desc = "edit index")
|
||||
Integer index,
|
||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "")
|
||||
Integer page) throws ExecutionException, InterruptedException {
|
||||
String pageCommand = "/" + arguments.get().replaceAll("-p [0-9]+", "").trim();
|
||||
Reference<PaginationBox> cached = player.getMeta(pageCommand);
|
||||
PaginationBox pages = cached == null ? null : cached.get();
|
||||
@@ -372,13 +409,15 @@ public class HistorySubCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "list",
|
||||
desc = "List your history"
|
||||
name = "list",
|
||||
desc = "List your history"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.list")
|
||||
public void list(Player player, LocalSession session, RollbackDatabase database, Arguments arguments,
|
||||
@Arg(desc = "Player uuid/name") UUID other,
|
||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "") Integer page) {
|
||||
@Arg(desc = "Player uuid/name")
|
||||
UUID other,
|
||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "")
|
||||
Integer page) {
|
||||
int index = session.getHistoryIndex();
|
||||
List<Supplier<? extends ChangeSet>> history = Lists.transform(session.getHistory(), (Function<ChangeSet, Supplier<ChangeSet>>) input -> () -> input);
|
||||
Location origin = player.getLocation();
|
||||
@@ -393,8 +432,8 @@ public class HistorySubCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "clear",
|
||||
desc = "Clear your history"
|
||||
name = "clear",
|
||||
desc = "Clear your history"
|
||||
)
|
||||
@CommandPermissions("worldedit.history.clear")
|
||||
public void clearHistory(Actor actor, LocalSession session) {
|
||||
|
@@ -88,13 +88,17 @@ public class ListFilters {
|
||||
@Override
|
||||
public File getPath(File root) {
|
||||
File newRoot = new File(root, finalArg);
|
||||
if (newRoot.exists()) return newRoot;
|
||||
if (newRoot.exists()) {
|
||||
return newRoot;
|
||||
}
|
||||
String firstArg = finalArg.substring(0, finalArg.length() - File.separator.length());
|
||||
if (firstArg.length() > 3 && firstArg.length() <= 16) {
|
||||
UUID fromName = Fawe.imp().getUUID(finalArg);
|
||||
if (fromName != null) {
|
||||
newRoot = new File(root, finalArg);
|
||||
if (newRoot.exists()) return newRoot;
|
||||
if (newRoot.exists()) {
|
||||
return newRoot;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new StopExecutionException(TextComponent.of("Cannot find path: " + finalArg));
|
||||
@@ -105,7 +109,7 @@ public class ListFilters {
|
||||
Pattern pattern;
|
||||
try {
|
||||
pattern = Pattern.compile(argLower);
|
||||
} catch (PatternSyntaxException ignore) {
|
||||
} catch (PatternSyntaxException ignored) {
|
||||
pattern = Pattern.compile(Pattern.quote(argLower));
|
||||
}
|
||||
Pattern finalPattern = pattern;
|
||||
|
@@ -9,7 +9,9 @@ import java.util.Optional;
|
||||
public class MethodCommands {
|
||||
|
||||
public static String getArguments(InjectedValueAccess context) {
|
||||
if (context == null) return null;
|
||||
if (context == null) {
|
||||
return null;
|
||||
}
|
||||
Optional<Arguments> arguments = context.injectedValue(Key.of(Arguments.class));
|
||||
return arguments.map(Arguments::get).orElse(null);
|
||||
}
|
||||
|
@@ -115,9 +115,9 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/air",
|
||||
aliases = {"/0"},
|
||||
desc = "Sets all the blocks in the region to air"
|
||||
name = "/air",
|
||||
aliases = {"/0"},
|
||||
desc = "Sets all the blocks in the region to air"
|
||||
)
|
||||
@CommandPermissions("worldedit.region.set")
|
||||
@Logging(REGION)
|
||||
@@ -126,18 +126,19 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/test",
|
||||
desc = "test region"
|
||||
name = "/test",
|
||||
desc = "test region"
|
||||
)
|
||||
@CommandPermissions("worldedit.region.test")
|
||||
@Logging(REGION)
|
||||
public void test(Player player, EditSession editSession, @Arg(desc = "test") double testValue) throws WorldEditException {
|
||||
public void test(Player player, EditSession editSession,
|
||||
@Arg(desc = "test") double testValue) throws WorldEditException {
|
||||
player.print(TextComponent.of(testValue));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/fixlighting",
|
||||
desc = "Get the light at a position"
|
||||
name = "/fixlighting",
|
||||
desc = "Get the light at a position"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.fix")
|
||||
public void fixLighting(Player player) throws WorldEditException {
|
||||
@@ -148,25 +149,25 @@ public class RegionCommands {
|
||||
final int cz = loc.getBlockZ() >> 4;
|
||||
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection,null, RelightMode.ALL);
|
||||
player.print(Caption.of("fawe.info.lighting.propagate.selection" , count));
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection, null, RelightMode.ALL);
|
||||
player.print(Caption.of("fawe.info.lighting.propagate.selection", count));
|
||||
}
|
||||
|
||||
// @Command(
|
||||
// name = "/getlighting",
|
||||
// desc = "Get the light at a position"
|
||||
// )
|
||||
// @CommandPermissions("worldedit.light.fix")
|
||||
// public void getLighting(Player player, EditSession editSession) throws WorldEditException {
|
||||
// final Location loc = player.getLocation();
|
||||
// int block = editSession.getBlockLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
// int sky = editSession.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
// player.print(TextComponent.of("Light: " + block + " | " + sky));
|
||||
// }
|
||||
// @Command(
|
||||
// name = "/getlighting",
|
||||
// desc = "Get the light at a position"
|
||||
// )
|
||||
// @CommandPermissions("worldedit.light.fix")
|
||||
// public void getLighting(Player player, EditSession editSession) throws WorldEditException {
|
||||
// final Location loc = player.getLocation();
|
||||
// int block = editSession.getBlockLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
// int sky = editSession.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
// player.print(TextComponent.of("Light: " + block + " | " + sky));
|
||||
// }
|
||||
|
||||
@Command(
|
||||
name = "/removelighting",
|
||||
desc = "Removing lighting in a selection"
|
||||
name = "/removelighting",
|
||||
desc = "Removing lighting in a selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.remove")
|
||||
public void removeLighting(Player player) {
|
||||
@@ -177,13 +178,13 @@ public class RegionCommands {
|
||||
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16));
|
||||
}
|
||||
int count = FaweAPI.fixLighting(player.getWorld(), selection, null, RelightMode.NONE);
|
||||
player.print(Caption.of("fawe.info.updated.lighting.selection" , count));
|
||||
player.print(Caption.of("fawe.info.updated.lighting.selection", count));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/nbtinfo",
|
||||
aliases = "/nbt",
|
||||
desc = "View nbt info for a block"
|
||||
name = "/nbtinfo",
|
||||
aliases = "/nbt",
|
||||
desc = "View nbt info for a block"
|
||||
)
|
||||
@CommandPermissions("worldedit.nbtinfo")
|
||||
public void nbtinfo(Player player, EditSession editSession) {
|
||||
@@ -201,8 +202,8 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/setblocklight",
|
||||
desc = "Set block lighting in a selection"
|
||||
name = "/setblocklight",
|
||||
desc = "Set block lighting in a selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setlighting(Player player, EditSession editSession, @Selection Region region) {
|
||||
@@ -210,8 +211,8 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/setskylight",
|
||||
desc = "Set sky lighting in a selection"
|
||||
name = "/setskylight",
|
||||
desc = "Set sky lighting in a selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setskylighting(Player player, @Selection Region region) {
|
||||
@@ -316,9 +317,9 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/lay",
|
||||
desc = "Set the top block in the region"
|
||||
)
|
||||
name = "/lay",
|
||||
desc = "Set the top block in the region"
|
||||
)
|
||||
@CommandPermissions("worldedit.region.overlay")
|
||||
@Logging(REGION)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
@@ -337,7 +338,7 @@ public class RegionCommands {
|
||||
editSession.setBlock(x, y, z, patternArg);
|
||||
affected++;
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.visitor.visitor.block" , affected));
|
||||
player.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@@ -412,7 +413,8 @@ public class RegionCommands {
|
||||
int iterations,
|
||||
@Arg(desc = "The mask of blocks to use as the height map", def = "")
|
||||
Mask mask,
|
||||
@Switch(name = 's', desc = "TODO") boolean snow) throws WorldEditException {
|
||||
@Switch(name = 's', desc = "The flag makes it only consider snow")
|
||||
boolean snow) throws WorldEditException {
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 max = region.getMaximumPoint();
|
||||
long volume = (((long) max.getX() - (long) min.getX() + 1) * ((long) max.getY() - (long) min.getY() + 1) * ((long) max.getZ() - (long) min.getZ() + 1));
|
||||
@@ -433,10 +435,10 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/wea",
|
||||
aliases = {"wea", "worldeditanywhere", "/worldeditanywhere", "/weanywhere"},
|
||||
desc = "Bypass region restrictions",
|
||||
descFooter = "Bypass region restrictions"
|
||||
name = "/wea",
|
||||
aliases = {"wea", "worldeditanywhere", "/worldeditanywhere", "/weanywhere"},
|
||||
desc = "Bypass region restrictions",
|
||||
descFooter = "Bypass region restrictions"
|
||||
)
|
||||
@CommandPermissions("fawe.admin")
|
||||
public void wea(Actor actor) throws WorldEditException {
|
||||
@@ -448,10 +450,10 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/wer",
|
||||
aliases = {"wer", "worldeditregion", "/worldeditregion", "select", "/select"},
|
||||
desc = "Select your current allowed region",
|
||||
descFooter = "Select your current allowed region"
|
||||
name = "/wer",
|
||||
aliases = {"wer", "worldeditregion", "/worldeditregion", "select", "/select"},
|
||||
desc = "Select your current allowed region",
|
||||
descFooter = "Select your current allowed region"
|
||||
)
|
||||
@CommandPermissions("fawe.worldeditregion")
|
||||
public void wer(Player player) throws WorldEditException {
|
||||
@@ -523,20 +525,21 @@ public class RegionCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/fall",
|
||||
desc = "Have the blocks in the selection fall",
|
||||
descFooter = "Make the blocks in the selection fall\n" +
|
||||
"The -m flag will only fall within the vertical selection."
|
||||
)
|
||||
name = "/fall",
|
||||
desc = "Have the blocks in the selection fall",
|
||||
descFooter = "Make the blocks in the selection fall\n"
|
||||
)
|
||||
@CommandPermissions("worldedit.region.fall")
|
||||
@Logging(ORIENTATION_REGION)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void fall(Player player, EditSession editSession, LocalSession session,
|
||||
@Selection Region region,
|
||||
@Arg(desc = "BlockStateHolder", def = "air") BlockStateHolder replace,
|
||||
@Switch(name = 'm', desc = "TODO") boolean notFullHeight) throws WorldEditException {
|
||||
@Arg(desc = "BlockStateHolder", def = "air")
|
||||
BlockStateHolder replace,
|
||||
@Switch(name = 'm', desc = "Only fall within the vertical selection")
|
||||
boolean notFullHeight) throws WorldEditException {
|
||||
int affected = editSession.fall(region, !notFullHeight, replace);
|
||||
player.print(Caption.of("fawe.worldedit.visitor.visitor.block" , affected));
|
||||
player.print(Caption.of("fawe.worldedit.visitor.visitor.block", affected));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@@ -598,14 +601,14 @@ public class RegionCommands {
|
||||
@Command(
|
||||
name = "/regen",
|
||||
desc = "Regenerates the contents of the selection",
|
||||
descFooter = "This command might affect things outside the selection,\n" +
|
||||
"if they are within the same chunk."
|
||||
descFooter = "This command might affect things outside the selection,\n"
|
||||
+ "if they are within the same chunk."
|
||||
)
|
||||
@CommandPermissions("worldedit.regen")
|
||||
@Logging(REGION)
|
||||
@Confirm(Confirm.Processor.REGION)
|
||||
public void regenerateChunk(Actor actor, World world, LocalSession session,
|
||||
EditSession editSession, @Selection Region region) throws WorldEditException {
|
||||
public void regenerateChunk(Actor actor, World world, LocalSession session, EditSession editSession,
|
||||
@Selection Region region) throws WorldEditException {
|
||||
Mask mask = session.getMask();
|
||||
boolean success;
|
||||
try {
|
||||
@@ -626,9 +629,9 @@ public class RegionCommands {
|
||||
@Command(
|
||||
name = "/deform",
|
||||
desc = "Deforms a selected region with an expression",
|
||||
descFooter = "The expression is executed for each block and is expected\n" +
|
||||
"to modify the variables x, y and z to point to a new block\n" +
|
||||
"to fetch. See also https://tinyurl.com/weexpr"
|
||||
descFooter = "The expression is executed for each block and is expected\n"
|
||||
+ "to modify the variables x, y and z to point to a new block\n"
|
||||
+ "to fetch. See also https://tinyurl.com/weexpr"
|
||||
)
|
||||
@CommandPermissions("worldedit.region.deform")
|
||||
@Logging(ALL)
|
||||
@@ -665,9 +668,15 @@ public class RegionCommands {
|
||||
zero = max.add(min).divide(2);
|
||||
unit = max.subtract(zero);
|
||||
|
||||
if (unit.getX() == 0) unit = unit.withX(1.0);
|
||||
if (unit.getY() == 0) unit = unit.withY(1.0);
|
||||
if (unit.getZ() == 0) unit = unit.withZ(1.0);
|
||||
if (unit.getX() == 0) {
|
||||
unit = unit.withX(1.0);
|
||||
}
|
||||
if (unit.getY() == 0) {
|
||||
unit = unit.withY(1.0);
|
||||
}
|
||||
if (unit.getZ() == 0) {
|
||||
unit = unit.withZ(1.0);
|
||||
}
|
||||
}
|
||||
|
||||
final Vector3 unit1 = unit;
|
||||
@@ -687,10 +696,9 @@ public class RegionCommands {
|
||||
@Command(
|
||||
name = "/hollow",
|
||||
desc = "Hollows out the object contained in this selection",
|
||||
descFooter = "Hollows out the object contained in this selection.\n" +
|
||||
"Optionally fills the hollowed out part with the given block.\n" +
|
||||
"Thickness is measured in manhattan distance."
|
||||
|
||||
descFooter = "Hollows out the object contained in this selection.\n"
|
||||
+ "Optionally fills the hollowed out part with the given block.\n"
|
||||
+ "Thickness is measured in manhattan distance."
|
||||
)
|
||||
@CommandPermissions("worldedit.region.hollow")
|
||||
@Logging(REGION)
|
||||
@@ -701,7 +709,8 @@ public class RegionCommands {
|
||||
int thickness,
|
||||
@Arg(desc = "The pattern of blocks to replace the hollowed area with", def = "air")
|
||||
Pattern pattern,
|
||||
@ArgFlag(name = 'm', desc = "Mask to hollow with") Mask mask) throws WorldEditException {
|
||||
@ArgFlag(name = 'm', desc = "Mask to hollow with")
|
||||
Mask mask) throws WorldEditException {
|
||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
|
||||
|
||||
|
@@ -116,8 +116,8 @@ public class SchematicCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "loadall",
|
||||
desc = "Load multiple clipboards (paste will randomly choose one)"
|
||||
name = "loadall",
|
||||
desc = "Load multiple clipboards (paste will randomly choose one)"
|
||||
)
|
||||
@Deprecated
|
||||
@CommandPermissions({"worldedit.clipboard.load", "worldedit.schematic.load", "worldedit.schematic.load.web", "worldedit.schematic.load.asset"})
|
||||
@@ -130,14 +130,14 @@ public class SchematicCommands {
|
||||
boolean randomRotate) throws FilenameException {
|
||||
final ClipboardFormat format = ClipboardFormats.findByAlias(formatName);
|
||||
if (format == null) {
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format" , formatName));
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.invalid.format", formatName));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
MultiClipboardHolder all = ClipboardFormats.loadAllFromInput(player, filename, null, true);
|
||||
if (all != null) {
|
||||
session.addClipboard(all);
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.loaded" , filename));
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -145,8 +145,8 @@ public class SchematicCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "clear",
|
||||
desc = "Clear your clipboard"
|
||||
name = "clear",
|
||||
desc = "Clear your clipboard"
|
||||
)
|
||||
@CommandPermissions({"worldedit.clipboard.clear", "worldedit.schematic.clear"})
|
||||
public void clear(Player player, LocalSession session) throws WorldEditException {
|
||||
@@ -155,8 +155,8 @@ public class SchematicCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "unload",
|
||||
desc = "Remove a clipboard from your multi-clipboard"
|
||||
name = "unload",
|
||||
desc = "Remove a clipboard from your multi-clipboard"
|
||||
)
|
||||
@CommandPermissions({"worldedit.clipboard.clear", "worldedit.schematic.clear"})
|
||||
public void unload(Player player, LocalSession session, String fileName) throws WorldEditException {
|
||||
@@ -177,7 +177,9 @@ public class SchematicCommands {
|
||||
if (identifiable instanceof MultiClipboardHolder) {
|
||||
MultiClipboardHolder multi = (MultiClipboardHolder) identifiable;
|
||||
multi.remove(uri);
|
||||
if (multi.getHolders().isEmpty()) session.setClipboard(null);
|
||||
if (multi.getHolders().isEmpty()) {
|
||||
session.setClipboard(null);
|
||||
}
|
||||
} else {
|
||||
session.setClipboard(null);
|
||||
}
|
||||
@@ -185,7 +187,7 @@ public class SchematicCommands {
|
||||
return;
|
||||
}
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.uri.not.found" , fileName));
|
||||
player.print(Caption.of("fawe.worldedit.clipboard.clipboard.uri.not.found", fileName));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@@ -272,7 +274,7 @@ public class SchematicCommands {
|
||||
uri = file.toURI();
|
||||
}
|
||||
format.hold(actor, uri, in);
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.loaded" , filename));
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename));
|
||||
} catch (IllegalArgumentException e) {
|
||||
actor.printError("Unknown filename: " + filename);
|
||||
} catch (URISyntaxException | IOException e) {
|
||||
@@ -301,8 +303,7 @@ public class SchematicCommands {
|
||||
@Switch(name = 'f', desc = "Overwrite an existing file.")
|
||||
boolean allowOverwrite,
|
||||
@Switch(name = 'g', desc = "//TODO")
|
||||
boolean global
|
||||
) throws WorldEditException {
|
||||
boolean global) throws WorldEditException {
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
|
||||
File dir = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
||||
@@ -401,7 +402,7 @@ public class SchematicCommands {
|
||||
for (File source : sources) {
|
||||
File destFile = new File(destDir, source.getName());
|
||||
if (destFile.exists()) {
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.exists" , destFile));
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.exists", destFile));
|
||||
continue;
|
||||
}
|
||||
if (Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS && (!MainUtil.isInSubDirectory(dir, destFile) || !MainUtil.isInSubDirectory(dir, source)) && !player.hasPermission("worldedit.schematic.delete.other")) {
|
||||
@@ -412,8 +413,10 @@ public class SchematicCommands {
|
||||
try {
|
||||
File cached = new File(source.getParentFile(), "." + source.getName() + ".cached");
|
||||
Files.move(source.toPath(), destFile.toPath());
|
||||
if (cached.exists()) Files.move(cached.toPath(), destFile.toPath());
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.success" , source, destFile));
|
||||
if (cached.exists()) {
|
||||
Files.move(cached.toPath(), destFile.toPath());
|
||||
}
|
||||
player.print(Caption.of("fawe.worldedit.schematic.schematic.move.success", source, destFile));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@@ -428,7 +431,9 @@ public class SchematicCommands {
|
||||
List<File> files = new ArrayList<>();
|
||||
for (URI uri : uris) {
|
||||
File file = new File(uri);
|
||||
if (file.exists()) files.add(file);
|
||||
if (file.exists()) {
|
||||
files.add(file);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
}
|
||||
@@ -475,9 +480,7 @@ public class SchematicCommands {
|
||||
@ArgFlag(name = 'f', desc = "Restricts by format.", def = "")
|
||||
String formatName,
|
||||
@Arg(name = "filter", desc = "Filter for schematics", def = "all")
|
||||
String filter,
|
||||
Arguments arguments
|
||||
) throws WorldEditException {
|
||||
String filter, Arguments arguments) throws WorldEditException {
|
||||
if (oldFirst && newFirst) {
|
||||
throw new StopExecutionException(TextComponent.of("Cannot sort by oldest and newest."));
|
||||
}
|
||||
@@ -633,7 +636,7 @@ public class SchematicCommands {
|
||||
writer.write(target);
|
||||
}
|
||||
log.info(actor.getName() + " saved " + file.getCanonicalPath());
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.saved" , file.getName()));
|
||||
actor.print(Caption.of("fawe.worldedit.schematic.schematic.saved", file.getName()));
|
||||
} else {
|
||||
actor.printError(TranslatableComponent.of("fawe.cancel.worldedit.cancel.reason.manual"));
|
||||
}
|
||||
@@ -686,7 +689,9 @@ public class SchematicCommands {
|
||||
}
|
||||
} else {
|
||||
res = Long.compare(f1.lastModified(), f2.lastModified()); // use date if there is a flag
|
||||
if (sortType == 1) res = -res; // flip date for newest first instead of oldest first
|
||||
if (sortType == 1) {
|
||||
res = -res; // flip date for newest first instead of oldest first
|
||||
}
|
||||
}
|
||||
return res;
|
||||
});
|
||||
@@ -699,7 +704,9 @@ public class SchematicCommands {
|
||||
//TODO filtering for directories, global, and private scheamtics needs to be reimplemented here
|
||||
private static List<File> getFiles(File root, String filter, ClipboardFormat format) {
|
||||
File[] files = root.listFiles();
|
||||
if (files == null) return null;
|
||||
if (files == null) {
|
||||
return null;
|
||||
}
|
||||
//Only get the files that match the format parameter
|
||||
if (format != null) {
|
||||
files = Arrays.stream(files).filter(format::isFormat).toArray(File[]::new);
|
||||
@@ -708,7 +715,9 @@ public class SchematicCommands {
|
||||
for (File f : files) {
|
||||
if (f.isDirectory()) {
|
||||
List<File> subFiles = getFiles(f, filter, format);
|
||||
if (subFiles == null) continue; // empty subdir
|
||||
if (subFiles == null) {
|
||||
continue; // empty subdir
|
||||
}
|
||||
fileList.addAll(subFiles);
|
||||
} else {
|
||||
fileList.add(f);
|
||||
@@ -723,8 +732,7 @@ public class SchematicCommands {
|
||||
desc = "Delete a saved schematic"
|
||||
)
|
||||
@CommandPermissions("worldedit.schematic.delete")
|
||||
public void delete(Actor actor,
|
||||
LocalSession session,
|
||||
public void delete(Actor actor, LocalSession session,
|
||||
@Arg(desc = "File name.")
|
||||
String filename) throws WorldEditException, IOException {
|
||||
LocalConfiguration config = worldEdit.getConfiguration();
|
||||
@@ -756,7 +764,7 @@ public class SchematicCommands {
|
||||
actor.printError(TranslatableComponent.of("worldedit.schematic.delete.failed", TextComponent.of(filename)));
|
||||
continue;
|
||||
}
|
||||
actor.print(Caption.of("worldedit.schematic.delete.deleted" , filename));
|
||||
actor.print(Caption.of("worldedit.schematic.delete.deleted", filename));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -559,7 +559,9 @@ public class SelectionCommands {
|
||||
}
|
||||
|
||||
BlockDistributionResult res = new BlockDistributionResult(distribution, separateStates);
|
||||
if (!actor.isPlayer()) res.formatForConsole();
|
||||
if (!actor.isPlayer()) {
|
||||
res.formatForConsole();
|
||||
}
|
||||
actor.print(res.create(page));
|
||||
}
|
||||
|
||||
|
@@ -88,8 +88,8 @@ public class ToolCommands {
|
||||
).build();
|
||||
}
|
||||
commandManager.register(CommandUtil.deprecate(
|
||||
command, "Global tool names cause conflicts " +
|
||||
"and will be removed in WorldEdit 8", ToolCommands::asNonGlobal
|
||||
command, "Global tool names cause conflicts "
|
||||
+ "and will be removed in WorldEdit 8", ToolCommands::asNonGlobal
|
||||
));
|
||||
}
|
||||
|
||||
|
@@ -51,6 +51,7 @@ import org.enginehub.piston.annotation.param.Switch;
|
||||
import org.jetbrains.annotations.Range;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Tool commands.
|
||||
@@ -64,18 +65,16 @@ public class ToolUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "mask",
|
||||
aliases = "/mask",
|
||||
desc = "Set the brush destination mask"
|
||||
name = "mask",
|
||||
aliases = "/mask",
|
||||
desc = "Set the brush destination mask"
|
||||
)
|
||||
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
||||
public void mask(Player player, LocalSession session,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
@Switch(name = 'h', desc = "Whether the offhand should be considered or not")
|
||||
boolean offHand,
|
||||
@Arg(desc = "The destination mask", def = "")
|
||||
Mask maskOpt,
|
||||
Arguments arguments)
|
||||
throws WorldEditException {
|
||||
Mask maskOpt, Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
@@ -96,32 +95,31 @@ public class ToolUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "material",
|
||||
aliases = {"mat", "/material", "pattern"},
|
||||
desc = "Set the brush material"
|
||||
name = "material",
|
||||
aliases = {"mat", "/material", "pattern"},
|
||||
desc = "Set the brush material"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.options.material")
|
||||
public void material(Player player, LocalSession session,
|
||||
@Arg(desc = "The pattern of blocks to use")
|
||||
Pattern pattern,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
Arguments arguments) throws WorldEditException {
|
||||
@Switch(name = 'h', desc = "Whether the offhand should be considered or not")
|
||||
boolean offHand, Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.printInfo(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (pattern == null) {
|
||||
tool.setFill(null);
|
||||
} else {
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.setFill(pattern);
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
||||
tool.update();
|
||||
}
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.material.set"));
|
||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||
settings.setFill(pattern);
|
||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
||||
tool.update();
|
||||
}
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.material.set"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@@ -169,9 +167,9 @@ public class ToolUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/superpickaxe",
|
||||
aliases = {",", "/sp", "/pickaxe", "/"},
|
||||
desc = "Toggle the super pickaxe function"
|
||||
name = "/superpickaxe",
|
||||
aliases = {",", "/sp", "/pickaxe", "/"},
|
||||
desc = "Toggle the super pickaxe function"
|
||||
)
|
||||
@CommandPermissions("worldedit.superpickaxe")
|
||||
public void togglePickaxe(Player player, LocalSession session,
|
||||
@@ -180,8 +178,8 @@ public class ToolUtilCommands {
|
||||
boolean hasSuperPickAxe = session.hasSuperPickAxe();
|
||||
if (superPickaxe != null && superPickaxe == hasSuperPickAxe) {
|
||||
player.printError(TranslatableComponent.of(superPickaxe ? "worldedit.tool.superpickaxe.enabled.already" : "worldedit.tool.superpickaxe.disabled.already"));
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (hasSuperPickAxe) {
|
||||
session.disableSuperPickAxe();
|
||||
player.printInfo(TranslatableComponent.of("worldedit.tool.superpickaxe.disabled"));
|
||||
@@ -192,10 +190,10 @@ public class ToolUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "primary",
|
||||
aliases = { "/primary" },
|
||||
desc = "Set the right click brush",
|
||||
descFooter = "Set the right click brush"
|
||||
name = "primary",
|
||||
aliases = { "/primary" },
|
||||
desc = "Set the right click brush",
|
||||
descFooter = "Set the right click brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.primary")
|
||||
public void primary(Player player, LocalSession session,
|
||||
@@ -213,15 +211,15 @@ public class ToolUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "secondary",
|
||||
aliases = { "/secondary" },
|
||||
desc = "Set the left click brush",
|
||||
descFooter = "Set the left click brush"
|
||||
name = "secondary",
|
||||
aliases = { "/secondary" },
|
||||
desc = "Set the left click brush",
|
||||
descFooter = "Set the left click brush"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.secondary")
|
||||
public void secondary(Player player, LocalSession session,
|
||||
@Arg(desc = "The brush command", variable = true) List<String> commandStr)
|
||||
throws WorldEditException {
|
||||
@Arg(desc = "The brush command", variable = true)
|
||||
List<String> commandStr) throws WorldEditException {
|
||||
BaseItem item = player.getItemInHand(HandSide.MAIN_HAND);
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
session.setTool(item, null, player);
|
||||
@@ -235,19 +233,19 @@ public class ToolUtilCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "visualize",
|
||||
aliases = {"visual", "vis", "/visualize", "/visual", "/vis"},
|
||||
desc = "Toggle between different visualization modes",
|
||||
descFooter = "Toggle between different visualization modes\n" +
|
||||
"0 = No visualization\n" +
|
||||
"1 = Single block at target position\n" +
|
||||
"2 = Glass showing what blocks will be changed"
|
||||
name = "visualize",
|
||||
aliases = {"visual", "vis", "/visualize", "/visual", "/vis"},
|
||||
desc = "Toggle between different visualization modes",
|
||||
descFooter = "Toggle between different visualization modes\n"
|
||||
+ "0 = No visualization\n"
|
||||
+ "1 = Single block at target position\n"
|
||||
+ "2 = Glass showing what blocks will be changed"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.visualize")
|
||||
public void visual(Player player, LocalSession session,
|
||||
@Arg(name = "mode", desc = "int", def = "0") @Range(from = 0, to = 2)
|
||||
int mode)
|
||||
throws WorldEditException {
|
||||
@Arg(name = "mode", desc = "int", def = "0")
|
||||
@Range(from = 0, to = 2)
|
||||
int mode) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
@@ -256,17 +254,18 @@ public class ToolUtilCommands {
|
||||
VisualMode[] modes = VisualMode.values();
|
||||
VisualMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
|
||||
tool.setVisualMode(player, newMode);
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.visual.mode.set" , newMode));
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.visual.mode.set", newMode));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "target",
|
||||
aliases = {"tar", "/target", "/tar"},
|
||||
desc = "Toggle between different target modes"
|
||||
name = "target",
|
||||
aliases = {"tar", "/target", "/tar"},
|
||||
desc = "Toggle between different target modes"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.target")
|
||||
public void target(Player player, LocalSession session,
|
||||
@Arg(name = "mode", desc = "int", def = "0") int mode) throws WorldEditException {
|
||||
@Arg(name = "mode", desc = "int", def = "0")
|
||||
int mode) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
@@ -275,13 +274,13 @@ public class ToolUtilCommands {
|
||||
TargetMode[] modes = TargetMode.values();
|
||||
TargetMode newMode = modes[MathMan.wrap(mode, 0, modes.length - 1)];
|
||||
tool.setTargetMode(newMode);
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.target.mode.set" , newMode));
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.target.mode.set", newMode));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "targetoffset",
|
||||
aliases = {"to"},
|
||||
desc = "Set the targeting mask"
|
||||
name = "targetoffset",
|
||||
aliases = {"to"},
|
||||
desc = "Set the targeting mask"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.targetoffset")
|
||||
public void targetOffset(Player player, EditSession editSession, LocalSession session,
|
||||
@@ -292,21 +291,21 @@ public class ToolUtilCommands {
|
||||
return;
|
||||
}
|
||||
tool.setTargetOffset(offset);
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.target.offset.set" , offset));
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.target.offset.set", offset));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "scroll",
|
||||
desc = "Toggle between different target modes"
|
||||
name = "scroll",
|
||||
desc = "Toggle between different target modes"
|
||||
)
|
||||
@CommandPermissions("worldedit.brush.scroll")
|
||||
public void scroll(Player player, EditSession editSession, LocalSession session,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
@Switch(name = 'h', desc = "Whether the offhand should be considered or not")
|
||||
boolean offHand,
|
||||
@Arg(desc = "Target Modes", def = "none")
|
||||
Scroll.Action mode,
|
||||
Scroll.Action mode,
|
||||
@Arg(desc = "The scroll action", variable = true)
|
||||
List<String> commandStr) throws WorldEditException {
|
||||
List<String> commandStr) throws WorldEditException {
|
||||
BrushTool bt = session.getBrushTool(player, false);
|
||||
if (bt == null) {
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.none"));
|
||||
@@ -319,9 +318,9 @@ public class ToolUtilCommands {
|
||||
if (mode == Scroll.Action.NONE) {
|
||||
player.print(TranslatableComponent.of("fawe.worldedit.brush.brush.scroll.action.unset"));
|
||||
} else if (action != null) {
|
||||
String full = (mode.name().toLowerCase() + " " + StringMan.join(commandStr, " ")).trim();
|
||||
String full = (mode.name().toLowerCase(Locale.ROOT) + " " + StringMan.join(commandStr, " ")).trim();
|
||||
settings.addSetting(BrushSettings.SettingType.SCROLL_ACTION, full);
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.scroll.action.set" , mode));
|
||||
player.print(Caption.of("fawe.worldedit.brush.brush.scroll.action.set", mode));
|
||||
}
|
||||
bt.update();
|
||||
}
|
||||
@@ -329,17 +328,17 @@ public class ToolUtilCommands {
|
||||
|
||||
|
||||
@Command(
|
||||
name = "smask",
|
||||
aliases = {"/smask", "/sourcemask", "sourcemask"},
|
||||
desc = "Set the brush source mask",
|
||||
descFooter = "Set the brush source mask"
|
||||
name = "smask",
|
||||
aliases = {"/smask", "/sourcemask", "sourcemask"},
|
||||
desc = "Set the brush source mask",
|
||||
descFooter = "Set the brush source mask"
|
||||
)
|
||||
@CommandPermissions({"worldedit.brush.options.mask", "worldedit.mask.brush"})
|
||||
public void smask(Player player, LocalSession session, EditSession editSession,
|
||||
@Arg(desc = "The destination mask", def = "")
|
||||
Mask maskArg,
|
||||
@Switch(name = 'h', desc = "TODO")
|
||||
boolean offHand,
|
||||
Mask maskArg,
|
||||
@Switch(name = 'h', desc = "Whether the offhand should be considered or not")
|
||||
boolean offHand,
|
||||
Arguments arguments) throws WorldEditException {
|
||||
BrushTool tool = session.getBrushTool(player, false);
|
||||
if (tool == null) {
|
||||
@@ -367,7 +366,7 @@ public class ToolUtilCommands {
|
||||
// @CommandPermissions({"worldedit.brush.options.transform", "worldedit.transform.brush"})
|
||||
// public void transform(Player player, LocalSession session, EditSession editSession,
|
||||
// @Arg(desc = "The transform", def = "") ResettableExtent transform,
|
||||
// @Switch(name = 'h', desc = "TODO")
|
||||
// @Switch(name = 'h', desc = "Whether the offhand should be considered or not")
|
||||
// boolean offHand,
|
||||
// Arguments arguments) throws WorldEditException {
|
||||
// BrushTool tool = session.getBrushTool(player, false);
|
||||
|
@@ -101,7 +101,7 @@ import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
|
||||
/**
|
||||
* Utility commands.
|
||||
*/
|
||||
@CommandContainer(superTypes = {CommandPermissionsConditionGenerator.Registration.class})
|
||||
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
|
||||
public class UtilityCommands {
|
||||
|
||||
private final WorldEdit we;
|
||||
@@ -111,8 +111,8 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/macro",
|
||||
desc = "Generate or run a macro"
|
||||
name = "/macro",
|
||||
desc = "Generate or run a macro"
|
||||
)
|
||||
@CommandPermissions("worldedit.macro")
|
||||
public void macro(Player player, LocalSession session, String name, String argument) throws IOException {
|
||||
@@ -120,9 +120,9 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/heightmapinterface",
|
||||
name = "/heightmapinterface",
|
||||
aliases = { "/hmi", "hmi" },
|
||||
desc = "Generate the heightmap interface: https://github.com/boy0001/HeightMap"
|
||||
desc = "Generate the heightmap interface: https://github.com/boy0001/HeightMap"
|
||||
)
|
||||
@CommandPermissions("fawe.admin")
|
||||
public void heightmapInterface(Player player, @Arg(name = "min", desc = "int", def = "100") int min, @Arg(name = "max", desc = "int", def = "200") int max) throws IOException {
|
||||
@@ -135,7 +135,7 @@ public class UtilityCommands {
|
||||
final int sub = srcFolder.getAbsolutePath().length();
|
||||
List<String> images = new ArrayList<>();
|
||||
MainUtil.iterateFiles(srcFolder, file -> {
|
||||
switch (file.getName().substring(file.getName().lastIndexOf('.')).toLowerCase()) {
|
||||
switch (file.getName().substring(file.getName().lastIndexOf('.')).toLowerCase(Locale.ROOT)) {
|
||||
case ".png":
|
||||
case ".jpeg":
|
||||
break;
|
||||
@@ -144,7 +144,9 @@ public class UtilityCommands {
|
||||
}
|
||||
try {
|
||||
String name = file.getAbsolutePath().substring(sub);
|
||||
if (name.startsWith(File.separator)) name = name.replaceFirst(java.util.regex.Pattern.quote(File.separator), "");
|
||||
if (name.startsWith(File.separator)) {
|
||||
name = name.replaceFirst(java.util.regex.Pattern.quote(File.separator), "");
|
||||
}
|
||||
BufferedImage img = MainUtil.readImage(file);
|
||||
BufferedImage minImg = ImageUtil.getScaledInstance(img, min, min, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
|
||||
BufferedImage maxImg = max == -1 ? img : ImageUtil.getScaledInstance(img, max, max, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
|
||||
@@ -173,20 +175,20 @@ public class UtilityCommands {
|
||||
config.append("// The local source for the image (used in commands)\n");
|
||||
config.append("var src_local = \"file://\";\n");
|
||||
File configFile = new File(webSrc, "config.js");
|
||||
player.print(TextComponent.of(String.format("Writing %s",configFile)));
|
||||
player.print(TextComponent.of(String.format("Writing %s", configFile)));
|
||||
Files.write(configFile.toPath(), config.toString().getBytes());
|
||||
player.print(TextComponent.of("Done! See: `FastAsyncWorldEdit/web/heightmap`"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
name = "/cancel",
|
||||
aliases= {"fcancel"},
|
||||
desc = "Cancel your current command"
|
||||
name = "/cancel",
|
||||
aliases = {"fcancel"},
|
||||
desc = "Cancel your current command"
|
||||
)
|
||||
@CommandPermissions(value = "fawe.cancel", queued = false)
|
||||
public void cancel(Player player) {
|
||||
int cancelled = player.cancel(false);
|
||||
player.print(Caption.of("fawe.cancel.worldedit.cancel.count" , cancelled));
|
||||
player.print(Caption.of("fawe.cancel.worldedit.cancel.count", cancelled));
|
||||
}
|
||||
|
||||
@Command(
|
||||
@@ -702,8 +704,8 @@ public class UtilityCommands {
|
||||
|
||||
|
||||
@Command(
|
||||
name = "/confirm",
|
||||
desc = "Confirm a command"
|
||||
name = "/confirm",
|
||||
desc = "Confirm a command"
|
||||
)
|
||||
@CommandPermissions(value = "fawe.confirm", queued = false)
|
||||
public void confirm(Player player) throws WorldEditException {
|
||||
@@ -746,15 +748,16 @@ public class UtilityCommands {
|
||||
if (file.isDirectory()) {
|
||||
type = URIType.DIRECTORY;
|
||||
} else {
|
||||
if (name.indexOf('.') != -1)
|
||||
if (name.indexOf('.') != -1) {
|
||||
name = name.substring(0, name.lastIndexOf('.'));
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (!MainUtil.isInSubDirectory(root, file)) {
|
||||
throw new RuntimeException(
|
||||
new StopExecutionException(TextComponent.of("Invalid path")));
|
||||
}
|
||||
} catch (IOException ignore) {
|
||||
} catch (IOException ignored) {
|
||||
}
|
||||
} else if (uriStr.startsWith("http://") || uriStr.startsWith("https://")) {
|
||||
type = URIType.URL;
|
||||
@@ -780,8 +783,9 @@ public class UtilityCommands {
|
||||
fileList.sort((f1, f2) -> {
|
||||
boolean dir1 = f1.isDirectory();
|
||||
boolean dir2 = f2.isDirectory();
|
||||
if (dir1 != dir2)
|
||||
if (dir1 != dir2) {
|
||||
return dir1 ? -1 : 1;
|
||||
}
|
||||
int res;
|
||||
if (sortType == 0) { // use name by default
|
||||
int p = f1.getParent().compareTo(f2.getParent());
|
||||
@@ -792,8 +796,9 @@ public class UtilityCommands {
|
||||
}
|
||||
} else {
|
||||
res = Long.compare(f1.lastModified(), f2.lastModified()); // use date if there is a flag
|
||||
if (sortType == 1)
|
||||
if (sortType == 1) {
|
||||
res = -res; // flip date for newest first instead of oldest first
|
||||
}
|
||||
}
|
||||
return res;
|
||||
});
|
||||
@@ -814,7 +819,7 @@ public class UtilityCommands {
|
||||
boolean listGlobal = !Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS;
|
||||
if (len > 0) {
|
||||
for (String arg : args) {
|
||||
switch (arg.toLowerCase()) {
|
||||
switch (arg.toLowerCase(Locale.ROOT)) {
|
||||
case "me":
|
||||
case "mine":
|
||||
case "local":
|
||||
@@ -874,21 +879,27 @@ public class UtilityCommands {
|
||||
forEachFile = new DelegateConsumer<File>(forEachFile) {
|
||||
@Override
|
||||
public void accept(File file) {
|
||||
if (cf.isFormat(file)) super.accept(file);
|
||||
if (cf.isFormat(file)) {
|
||||
super.accept(file);
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
forEachFile = new DelegateConsumer<File>(forEachFile) {
|
||||
@Override
|
||||
public void accept(File file) {
|
||||
if (!file.toString().endsWith(".cached")) super.accept(file);
|
||||
if (!file.toString().endsWith(".cached")) {
|
||||
super.accept(file);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
if (playerFolder) {
|
||||
if (listMine) {
|
||||
File playerDir = MainUtil.resolveRelative(new File(dir, actor.getUniqueId() + dirFilter));
|
||||
if (playerDir.exists()) allFiles(playerDir.listFiles(), false, forEachFile);
|
||||
if (playerDir.exists()) {
|
||||
allFiles(playerDir.listFiles(), false, forEachFile);
|
||||
}
|
||||
}
|
||||
if (listGlobal) {
|
||||
File rel = MainUtil.resolveRelative(new File(dir, dirFilter));
|
||||
@@ -905,37 +916,51 @@ public class UtilityCommands {
|
||||
super.accept(f);
|
||||
}
|
||||
};
|
||||
if (rel.exists()) allFiles(rel.listFiles(), false, forEachFile);
|
||||
if (rel.exists()) {
|
||||
allFiles(rel.listFiles(), false, forEachFile);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
File rel = MainUtil.resolveRelative(new File(dir, dirFilter));
|
||||
if (rel.exists()) allFiles(rel.listFiles(), false, forEachFile);
|
||||
if (rel.exists()) {
|
||||
allFiles(rel.listFiles(), false, forEachFile);
|
||||
}
|
||||
}
|
||||
if (!filters.isEmpty() && !toFilter.isEmpty()) {
|
||||
List<File> result = filter(toFilter, filters);
|
||||
for (File file : result) rootFunction.accept(file);
|
||||
for (File file : result) {
|
||||
rootFunction.accept(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static List<File> filter(List<File> fileList, List<String> filters) {
|
||||
String[] normalizedNames = new String[fileList.size()];
|
||||
for (int i = 0; i < fileList.size(); i++) {
|
||||
String normalized = fileList.get(i).getName().toLowerCase();
|
||||
if (normalized.startsWith("../")) normalized = normalized.substring(3);
|
||||
String normalized = fileList.get(i).getName().toLowerCase(Locale.ROOT);
|
||||
if (normalized.startsWith("../")) {
|
||||
normalized = normalized.substring(3);
|
||||
}
|
||||
normalizedNames[i] = normalized.replace("/", File.separator);
|
||||
}
|
||||
|
||||
for (String filter : filters) {
|
||||
if (fileList.isEmpty()) return fileList;
|
||||
String lowerFilter = filter.toLowerCase().replace("/", File.separator);
|
||||
if (fileList.isEmpty()) {
|
||||
return fileList;
|
||||
}
|
||||
String lowerFilter = filter.toLowerCase(Locale.ROOT).replace("/", File.separator);
|
||||
List<File> newList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < normalizedNames.length; i++) {
|
||||
if (normalizedNames[i].startsWith(lowerFilter)) newList.add(fileList.get(i));
|
||||
if (normalizedNames[i].startsWith(lowerFilter)) {
|
||||
newList.add(fileList.get(i));
|
||||
}
|
||||
}
|
||||
if (newList.isEmpty()) {
|
||||
for (int i = 0; i < normalizedNames.length; i++) {
|
||||
if (normalizedNames[i].contains(lowerFilter)) newList.add(fileList.get(i));
|
||||
if (normalizedNames[i].contains(lowerFilter)) {
|
||||
newList.add(fileList.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (newList.isEmpty()) {
|
||||
@@ -943,9 +968,11 @@ public class UtilityCommands {
|
||||
if (checkName.length() > 3 && checkName.length() <= 16) {
|
||||
UUID fromName = Fawe.imp().getUUID(checkName);
|
||||
if (fromName != null) {
|
||||
lowerFilter = filter.replaceFirst(checkName, fromName.toString()).toLowerCase();
|
||||
lowerFilter = filter.replaceFirst(checkName, fromName.toString()).toLowerCase(Locale.ROOT);
|
||||
for (int i = 0; i < normalizedNames.length; i++) {
|
||||
if (normalizedNames[i].startsWith(lowerFilter)) newList.add(fileList.get(i));
|
||||
if (normalizedNames[i].startsWith(lowerFilter)) {
|
||||
newList.add(fileList.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -957,7 +984,9 @@ public class UtilityCommands {
|
||||
}
|
||||
|
||||
public static void allFiles(File[] files, boolean recursive, Consumer<File> task) {
|
||||
if (files == null || files.length == 0) return;
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
for (File f : files) {
|
||||
if (f.isDirectory()) {
|
||||
if (recursive) {
|
||||
|
@@ -78,22 +78,22 @@ public class WorldEditCommands {
|
||||
FaweVersion fVer = Fawe.get().getVersion();
|
||||
String fVerStr = fVer == null ? "unknown" : "-" + fVer.build;
|
||||
actor.print(TextComponent.of("FastAsyncWorldEdit" + fVerStr + " created by Empire92, MattBDev, IronApollo, dordsor21 and NotMyFault"));
|
||||
|
||||
|
||||
if (fVer != null) {
|
||||
FaweVersion version = Fawe.get().getVersion();
|
||||
Date date = new GregorianCalendar(2000 + version.year, version.month - 1, version.day)
|
||||
.getTime();
|
||||
|
||||
TextComponent dateArg = TextComponent.of(date.toLocaleString());
|
||||
TextComponent commitArg = TextComponent.of(Integer.toHexString(version.hash));
|
||||
TextComponent buildArg = TextComponent.of(version.build);
|
||||
TextComponent platformArg = TextComponent.of(Settings.IMP.PLATFORM);
|
||||
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.version.version", dateArg, commitArg, buildArg, platformArg));
|
||||
|
||||
TextComponent dateArg = TextComponent.of(date.toLocaleString());
|
||||
TextComponent commitArg = TextComponent.of(Integer.toHexString(version.hash));
|
||||
TextComponent buildArg = TextComponent.of(version.build);
|
||||
TextComponent platformArg = TextComponent.of(Settings.IMP.PLATFORM);
|
||||
|
||||
actor.printInfo(TranslatableComponent.of("worldedit.version.version", dateArg, commitArg, buildArg, platformArg));
|
||||
}
|
||||
|
||||
actor.printInfo(TextComponent.of("Wiki: https://wiki.intellectualsites.com/FastAsyncWorldEdit/index"));
|
||||
|
||||
|
||||
actor.printInfo(TextComponent.of("Wiki: https://wiki.intellectualsites.com/FastAsyncWorldEdit/index"));
|
||||
|
||||
PlatformManager pm = we.getPlatformManager();
|
||||
|
||||
TextComponentProducer producer = new TextComponentProducer();
|
||||
@@ -104,19 +104,19 @@ public class WorldEditCommands {
|
||||
.append(TextComponent.of("(" + platform.getPlatformVersion() + ")"))
|
||||
).newline();
|
||||
}
|
||||
actor.print(new MessageBox("Platforms", producer, TextColor.GRAY).create());
|
||||
|
||||
producer.reset();
|
||||
for (Capability capability : Capability.values()) {
|
||||
actor.print(new MessageBox("Platforms", producer, TextColor.GRAY).create());
|
||||
|
||||
producer.reset();
|
||||
for (Capability capability : Capability.values()) {
|
||||
Platform platform = pm.queryCapability(capability);
|
||||
producer.append(
|
||||
TextComponent.of(capability.name(), TextColor.GRAY)
|
||||
TextComponent.of(capability.name(), TextColor.GRAY)
|
||||
.append(TextComponent.of(": ")
|
||||
.append(TextComponent.of(platform != null ? platform.getPlatformName() : "NONE")))
|
||||
).newline();
|
||||
}
|
||||
actor.print(new MessageBox("Capabilities", producer, TextColor.GRAY).create());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@@ -67,7 +67,7 @@ public class AreaPickaxe implements BlockTool {
|
||||
|
||||
try {
|
||||
for (int x = ox - range; x <= ox + range; ++x) {
|
||||
for (int y = oy - range; y <= oy + range; ++y) {
|
||||
for (int y = oy - range; y <= oy + range; ++y) {
|
||||
for (int z = oz - range; z <= oz + range; ++z) {
|
||||
if (!initialType.equals(editSession.getBlock(x, y, z).getBlockType())) {
|
||||
continue;
|
||||
|
@@ -280,7 +280,7 @@ public class BrushTool
|
||||
/**
|
||||
* Set the brush.
|
||||
*
|
||||
* @param brush tbe brush
|
||||
* @param brush the brush
|
||||
* @param permission the permission
|
||||
*/
|
||||
public void setBrush(Brush brush, String permission) {
|
||||
|
@@ -33,7 +33,7 @@ public enum NavigationWand implements DoubleActionTraceTool {
|
||||
@Override
|
||||
public boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session) {
|
||||
if (!player.hasPermission("worldedit.navigation.jumpto.tool")) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
final int maxDist = config.navigationWandMaxDistance;
|
||||
if (maxDist <= 0) {
|
||||
|
Reference in New Issue
Block a user