use of com.sk89q.worldedit.command.util.Logging in project FastAsyncWorldEdit by IntellectualSites.
the class GenerationCommands method ores.
@Command(name = "/ores", desc = "Generates ores")
@CommandPermissions("worldedit.generation.ore")
@Logging(PLACEMENT)
@Preload(Preload.PreloadCheck.PRELOAD)
@Confirm(Confirm.Processor.REGION)
public void ores(Actor actor, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "Mask") Mask mask) throws WorldEditException {
new MaskTraverser(mask).setNewExtent(editSession);
editSession.addOres(region, mask);
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block", editSession.getBlockChangeCount()));
}
use of com.sk89q.worldedit.command.util.Logging in project FastAsyncWorldEdit by IntellectualSites.
the class GenerationCommands method blobBrush.
@Command(name = "/blob", aliases = { "/rock" }, desc = "Creates a distorted sphere")
@Logging(PLACEMENT)
@CommandPermissions("worldedit.generation.blob")
public int blobBrush(Actor actor, LocalSession session, EditSession editSession, @Arg(desc = "Pattern") Pattern pattern, @Arg(desc = "size", def = "5") double size, @Arg(desc = "radius", def = "5") Vector3 radius, @Arg(name = "roundness", desc = "roundness", def = "100") double sphericity, @Arg(desc = "double", def = "30") double frequency, @Arg(desc = "double", def = "50") double amplitude) throws WorldEditException {
double max = MathMan.max(radius.getX(), radius.getY(), radius.getZ());
worldEdit.checkMaxRadius(max);
BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.makeBlob(pos, pattern, size, frequency / 100, amplitude / 100, radius.divide(max), sphericity / 100);
if (actor instanceof Player) {
((Player) actor).findFreePosition();
}
actor.print(Caption.of("worldedit.sphere.created", TextComponent.of(affected)));
return affected;
}
use of com.sk89q.worldedit.command.util.Logging in project FastAsyncWorldEdit by IntellectualSites.
the class SelectionCommands method pos1.
@Command(name = "/pos1", aliases = "/1", desc = "Set position 1")
@Logging(POSITION)
@CommandPermissions("worldedit.selection.pos")
public void pos1(Actor actor, World world, LocalSession session, @Arg(desc = "Coordinates to set position 1 to", def = "") BlockVector3 coordinates) throws WorldEditException {
Location pos;
// FAWE start - clamp
if (coordinates != null) {
pos = new Location(world, coordinates.toVector3().clampY(world.getMinY(), world.getMaxY()));
} else if (actor instanceof Locatable) {
pos = ((Locatable) actor).getBlockLocation().clampY(world.getMinY(), world.getMaxY());
// FAWE end
} else {
actor.print(Caption.of("worldedit.pos.console-require-coords"));
return;
}
if (!session.getRegionSelector(world).selectPrimary(pos.toVector().toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
actor.print(Caption.of("worldedit.pos.already-set"));
return;
}
session.getRegionSelector(world).explainPrimarySelection(actor, session, pos.toVector().toBlockPoint());
}
use of com.sk89q.worldedit.command.util.Logging in project FastAsyncWorldEdit by IntellectualSites.
the class UtilityCommands method fillr.
/*
@Command(
name = "masks",
desc = "View help about masks",
descFooter = "Masks determine if a block can be placed\n" +
" - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" +
" - Use & to AND multiple\n" +
"e.g., >[stone,dirt],#light[0][5],$jungle\n" +
"More Info: https://git.io/v9r4K"
)
@CommandQueued(false)
@CommandPermissions("worldedit.masks")
public void masks(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
displayModifierHelp(player, DefaultMaskParser.class, args);
}
@Command(
name = "transforms",
desc = "View help about transforms",
descFooter = "Transforms modify how a block is placed\n" +
" - Use [brackets] for arguments\n" +
" - Use , to OR multiple\n" +
" - Use & to AND multiple\n" +
"More Info: https://git.io/v9KHO",
)
@CommandQueued(false)
@CommandPermissions("worldedit.transforms")
public void transforms(Player player, LocalSession session, InjectedValueAccess args) throws WorldEditException {
displayModifierHelp(player, DefaultTransformParser.class, args);
}
private void displayModifierHelp(Player player, Class<? extends FaweParser> clazz, InjectedValueAccess args) {
FaweParser parser = FaweAPI.getParser(clazz);
if (args.argsLength() == 0) {
String base = getCommand().aliases()[0];
UsageMessage msg = new UsageMessage(getCallable(), "/" + base, args.getLocals());
msg.newline().paginate(base, 0, 1).send(player);
return;
}
if (parser != null) {
CommandMapping mapping = parser.getDispatcher().get(args.getString(0));
if (mapping != null) {
new UsageMessage(mapping.getCallable(), args.getString(0), args.getLocals()) {
@Override
public String separateArg(String arg) {
return "&7[" + arg + "&7]";
}
}.send(player);
} else {
UtilityCommands.help(args, player, getCommand().aliases()[0] + " ", parser.getDispatcher());
}
}
}
*/
@Command(name = "/fillr", desc = "Fill a hole recursively")
@CommandPermissions("worldedit.fill.recursive")
@Logging(PLACEMENT)
public int fillr(Actor actor, LocalSession session, EditSession editSession, @Arg(desc = "The blocks to fill with") Pattern pattern, // FAWE start - we take an expression over a double
@Arg(desc = "The radius to fill in") Expression radiusExp, // FAWE end
@Arg(desc = "The depth to fill", def = "") Integer depth) throws WorldEditException {
// FAWE start
double radius = radiusExp.evaluate();
// FAWE end
radius = Math.max(1, radius);
we.checkMaxRadius(radius);
depth = depth == null ? Integer.MAX_VALUE : Math.max(1, depth);
we.checkMaxRadius(radius);
BlockVector3 pos = session.getPlacementPosition(actor);
int affected = editSession.fillXZ(pos, pattern, radius, depth, true);
actor.print(Caption.of("worldedit.fillr.created", TextComponent.of(affected)));
return affected;
}
use of com.sk89q.worldedit.command.util.Logging in project FastAsyncWorldEdit by IntellectualSites.
the class UtilityCommands method replaceNear.
@Command(name = "replacenear", aliases = { "/replacenear" }, desc = "Replace nearby blocks")
@CommandPermissions("worldedit.replacenear")
@Logging(PLACEMENT)
public int replaceNear(Actor actor, World world, LocalSession session, EditSession editSession, @Arg(desc = "The radius of the square to remove in") int radius, @Arg(desc = "The mask matching blocks to remove", def = "") Mask from, @Arg(desc = "The pattern of blocks to replace with") Pattern to) throws WorldEditException {
// FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow)
new MaskTraverser(from).setNewExtent(editSession);
// FAWE end
radius = Math.max(1, radius);
we.checkMaxRadius(radius);
BlockVector3 base = session.getPlacementPosition(actor);
BlockVector3 min = base.subtract(radius, radius, radius);
BlockVector3 max = base.add(radius, radius, radius);
Region region = new CuboidRegion(world, min, max);
if (from == null) {
from = new ExistingBlockMask(editSession);
}
int affected = editSession.replaceBlocks(region, from, to);
actor.print(Caption.of("worldedit.replacenear.replaced", TextComponent.of(affected)));
return affected;
}
Aggregations