Minor changes

This commit is contained in:
MattBDev 2019-12-11 17:46:47 -05:00
parent 50856e1f85
commit 9bef8d5664
4 changed files with 49 additions and 54 deletions

View File

@ -22,7 +22,7 @@ public class Caption {
/**
* Colorize a component with legacy color codes
* @param parent
* @param component
* @param locale
* @return Component
*/

View File

@ -19,9 +19,16 @@
package com.sk89q.worldedit.command;
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.object.FaweLimit;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
@ -29,15 +36,15 @@ import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.command.util.CommandPermissions;
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
import com.sk89q.worldedit.command.util.annotation.Confirm;
import com.sk89q.worldedit.command.util.Logging;
import com.sk89q.worldedit.command.util.annotation.Confirm;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.function.GroundFunction;
import com.sk89q.worldedit.function.generator.FloraGenerator;
import com.sk89q.worldedit.function.mask.MaskIntersection;
import com.sk89q.worldedit.function.mask.ExistingBlockMask;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.mask.MaskIntersection;
import com.sk89q.worldedit.function.mask.NoiseFilter2D;
import com.sk89q.worldedit.function.mask.SolidBlockMask;
import com.sk89q.worldedit.function.operation.Operations;
@ -58,15 +65,17 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.regions.RegionOperationException;
import com.sk89q.worldedit.regions.Regions;
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.world.block.BlockTypes;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
@ -74,19 +83,6 @@ import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
import org.jetbrains.annotations.Range;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import static com.sk89q.worldedit.command.util.Logging.LogMode.ORIENTATION_REGION;
import static com.sk89q.worldedit.command.util.Logging.LogMode.REGION;
import static com.sk89q.worldedit.command.util.annotation.Confirm.Processor.RADIUS;
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
/**
* Commands that operate on regions.
*/
@ -288,7 +284,7 @@ public class RegionCommands {
@Command(
name = "/replace",
aliases = { "/repl", "/rep" },
aliases = { "/re", "/rep" },
desc = "Replace all blocks in the selection with another"
)
@CommandPermissions("worldedit.region.replace")
@ -493,7 +489,7 @@ public class RegionCommands {
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air", def = "")
Mask mask) throws WorldEditException {
checkCommandArgument(count >= 1, "Count must be >= 1");
Mask combinedMask;
if (ignoreAirBlocks) {
if (mask == null) {
@ -504,7 +500,7 @@ public class RegionCommands {
} else {
combinedMask = mask;
}
int affected = editSession.moveRegion(region, direction, count, !skipEntities, copyBiomes, combinedMask, replace);
if (moveSelection) {
@ -548,7 +544,8 @@ public class RegionCommands {
public int stack(Actor actor, World world, EditSession editSession, LocalSession session,
@Selection Region region,
@Arg(desc = "# of copies to stack", def = "1")
@Confirm(Confirm.Processor.REGION) int count,
@Confirm(Confirm.Processor.REGION)
int count,
@Arg(desc = "The direction to stack", def = Direction.AIM)
@Direction(includeDiagonals = true)
BlockVector3 direction,
@ -562,7 +559,7 @@ public class RegionCommands {
boolean copyBiomes,
@ArgFlag(name = 'm', desc = "Set the include mask, non-matching blocks become air", def = "")
Mask mask) throws WorldEditException {
Mask combinedMask;
if (ignoreAirBlocks) {
if (mask == null) {
@ -573,7 +570,7 @@ public class RegionCommands {
} else {
combinedMask = mask;
}
int affected = editSession.stackCuboidRegion(region, direction, count, !skipEntities, copyBiomes, combinedMask);
if (moveSelection) {
@ -594,6 +591,29 @@ public class RegionCommands {
return affected;
}
@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."
)
@CommandPermissions("worldedit.regen")
@Logging(REGION)
@Confirm(Confirm.Processor.REGION)
public void regenerateChunk(Actor actor, World world, LocalSession session,
EditSession editSession, @Selection Region region,
@Arg(def = "", desc = "Regenerate with biome") BiomeType biome,
@Arg(def = "", desc = "Regenerate with seed") Long seed) throws WorldEditException {
Mask mask = session.getMask();
session.setMask((Mask) null);
session.setSourceMask((Mask) null);
world.regenerate(region, editSession);
// editSession.regenerate(region, biome, seed);
session.setMask(mask);
session.setSourceMask(mask);
actor.printInfo(TranslatableComponent.of("worldedit.regen.regenerated"));
}
@Command(
name = "/deform",
desc = "Deforms a selected region with an expression",
@ -645,30 +665,6 @@ public class RegionCommands {
}
}
@Command(
name = "/regen",
desc = "Regenerates the contents of the selection",
descFooter =
"Regenerates the contents of the current selection.\n" +
"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,
@Arg(def = "", desc = "Regenerate with biome") BiomeType biome,
@Arg(def = "", desc = "Regenerate with seed") Long seed) throws WorldEditException {
Mask mask = session.getMask();
session.setMask((Mask) null);
session.setSourceMask((Mask) null);
world.regenerate(region, editSession);
// editSession.regenerate(region, biome, seed);
session.setMask(mask);
session.setSourceMask(mask);
actor.printInfo(TranslatableComponent.of("worldedit.regen.regenerated"));
}
@Command(
name = "/hollow",
desc = "Hollows out the object contained in this selection",

View File

@ -20,9 +20,6 @@
package com.sk89q.worldedit.function.visitor;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.RegionFunction;
import com.sk89q.worldedit.function.operation.Operation;
@ -31,6 +28,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.formatting.text.Component;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
/**
@ -60,7 +58,7 @@ public class RegionVisitor implements Operation {
/**
* Deprecated in favor of the other constructors which will preload chunks during iteration
*
* @param region
* @param iterable
* @param function
*/
@Deprecated

View File

@ -130,6 +130,7 @@ public interface TranslatableComponent extends BuildableComponent<TranslatableCo
}
// FAWE added
//TODO REMOVE THIS BECAUSE IT'S SO STUPID!
@Nonnull
public static TranslatableComponent of(@Nonnull final String key, final Object... args) {
List<Component> components = Arrays.stream(args)