conflicts

This commit is contained in:
Jesse Boyd 2019-08-07 01:25:53 +10:00
parent accc62c10b
commit b6bc09226c
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
4 changed files with 113 additions and 108 deletions

View File

@ -80,6 +80,7 @@ import java.util.List;
import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer; import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg; import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch; import org.enginehub.piston.annotation.param.Switch;
import org.enginehub.piston.inject.InjectedValueAccess; import org.enginehub.piston.inject.InjectedValueAccess;
@ -107,16 +108,16 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.set") @CommandPermissions("worldedit.region.set")
@Logging(REGION) @Logging(REGION)
public void set(FawePlayer player, EditSession editSession, public void set(FawePlayer fp, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern, InjectedValueAccess context) throws WorldEditException { Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
int affected = editSession.setBlocks(region, pattern); int affected = editSession.setBlocks(region, patternArg);
if (affected != 0) { if (affected != 0) {
BBC.OPERATION.send(player, affected); BBC.OPERATION.send(fp, affected);
if (!player.hasPermission("fawe.tips")) if (!fp.hasPermission("fawe.tips"))
BBC.TIP_FAST.or(BBC.TIP_CANCEL, BBC.TIP_MASK, BBC.TIP_MASK_ANGLE, BBC.TIP_SET_LINEAR, BBC.TIP_SURFACE_SPREAD, BBC.TIP_SET_HAND).send(player); BBC.TIP_FAST.or(BBC.TIP_CANCEL, BBC.TIP_MASK, BBC.TIP_MASK_ANGLE, BBC.TIP_SET_LINEAR, BBC.TIP_SURFACE_SPREAD, BBC.TIP_SET_HAND).send(fp);
} }
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -136,7 +137,7 @@ public class RegionCommands {
selection = new CuboidRegion(BlockVector3.at(cx - 8, 0, cz - 8).multiply(16), BlockVector3.at(cx + 8, 0, cz + 8).multiply(16)); 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); int count = FaweAPI.fixLighting(player.getWorld(), selection,null);
BBC.LIGHTING_PROPOGATE_SELECTION.send(fp, count); BBC.LIGHTING_PROPAGATE_SELECTION.send(fp, count);
} }
@Command( @Command(
@ -216,7 +217,7 @@ public class RegionCommands {
public int line(Actor actor, EditSession editSession, public int line(Actor actor, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "The pattern of blocks to place") @Arg(desc = "The pattern of blocks to place")
Pattern pattern, Pattern patternArg,
@Range(min = 1) @Arg(desc = "The thickness of the line", def = "0") @Range(min = 1) @Arg(desc = "The thickness of the line", def = "0")
int thickness, int thickness,
@Switch(name = 'h', desc = "Generate only a shell") @Switch(name = 'h', desc = "Generate only a shell")
@ -230,7 +231,7 @@ public class RegionCommands {
CuboidRegion cuboidregion = (CuboidRegion) region; CuboidRegion cuboidregion = (CuboidRegion) region;
BlockVector3 pos1 = cuboidregion.getPos1(); BlockVector3 pos1 = cuboidregion.getPos1();
BlockVector3 pos2 = cuboidregion.getPos2(); BlockVector3 pos2 = cuboidregion.getPos2();
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell); int blocksChanged = editSession.drawLine(patternArg, pos1, pos2, thickness, !shell);
BBC.VISITOR_BLOCK.send(actor, blocksChanged); BBC.VISITOR_BLOCK.send(actor, blocksChanged);
return blocksChanged; return blocksChanged;
@ -243,27 +244,27 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.curve") @CommandPermissions("worldedit.region.curve")
@Logging(REGION) @Logging(REGION)
public void curve(FawePlayer player, EditSession editSession, public void curve(FawePlayer fp, EditSession editSession,
@Selection Region region, @Selection Region region,
@Arg(desc = "The pattern of blocks to place") @Arg(desc = "The pattern of blocks to place")
Pattern pattern, Pattern patternArg,
@Arg(desc = "The thickness of the curve", def = "0") @Arg(desc = "The thickness of the curve", def = "0")
int thickness, int thickness,
@Switch(name = 'h', desc = "Generate only a shell") @Switch(name = 'h', desc = "Generate only a shell")
boolean shell, InjectedValueAccess context) throws WorldEditException { boolean shell, InjectedValueAccess context) throws WorldEditException {
if (!(region instanceof ConvexPolyhedralRegion)) { if (!(region instanceof ConvexPolyhedralRegion)) {
player.printError("//curve only works with convex polyhedral selections"); fp.printError("//curve only works with convex polyhedral selections");
return; return;
} }
checkCommandArgument(thickness >= 0, "Thickness must be >= 0"); checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region; ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices()); List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices());
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell); int blocksChanged = editSession.drawSpline(patternArg, vectors, 0, 0, 0, 10, thickness, !shell);
BBC.VISITOR_BLOCK.send(player, blocksChanged); BBC.VISITOR_BLOCK.send(fp, blocksChanged);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -274,7 +275,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.replace") @CommandPermissions("worldedit.region.replace")
@Logging(REGION) @Logging(REGION)
public void replace(FawePlayer player, EditSession editSession, @Selection Region region, public void replace(FawePlayer fp, EditSession editSession, @Selection Region region,
@Arg(desc = "The mask representing blocks to replace", def = "") @Arg(desc = "The mask representing blocks to replace", def = "")
Mask from, Mask from,
@Arg(desc = "The pattern of blocks to replace with") @Arg(desc = "The pattern of blocks to replace with")
@ -282,23 +283,18 @@ public class RegionCommands {
if (from == null) { if (from == null) {
from = new ExistingBlockMask(editSession); from = new ExistingBlockMask(editSession);
} }
player.checkConfirmationRegion(() -> { Mask finalFrom = from;
int affected = editSession.replaceBlocks(region, from == null ? new ExistingBlockMask(editSession) : from, to); fp.checkConfirmationRegion(() -> {
BBC.VISITOR_BLOCK.send(player, affected); int affected = editSession.replaceBlocks(region, finalFrom, to);
if (!player.hasPermission("fawe.tips")) { BBC.VISITOR_BLOCK.send(fp, affected);
if (!fp.hasPermission("fawe.tips")) {
BBC.TIP_REPLACE_ID BBC.TIP_REPLACE_ID
.or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE, .or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE,
BBC.TIP_REPLACE_REGEX, BBC.TIP_REPLACE_REGEX_2, BBC.TIP_REPLACE_REGEX_3, BBC.TIP_REPLACE_REGEX, BBC.TIP_REPLACE_REGEX_2, BBC.TIP_REPLACE_REGEX_3,
BBC.TIP_REPLACE_REGEX_4, BBC.TIP_REPLACE_REGEX_5).send(player); BBC.TIP_REPLACE_REGEX_4, BBC.TIP_REPLACE_REGEX_5).send(fp);
} }
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
// Compatibility for SKCompat
@Deprecated
public void set(Player player, LocalSession session, EditSession editSession, Pattern pattern) throws WorldEditException {
set(FawePlayer.wrap(player), session, editSession, session.getSelection(player.getWorld()), pattern, null);
}
@Command( @Command(
name = "/overlay", name = "/overlay",
@ -306,12 +302,12 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.overlay") @CommandPermissions("worldedit.region.overlay")
@Logging(REGION) @Logging(REGION)
public void overlay(FawePlayer player, EditSession editSession, @Selection Region region, public void overlay(FawePlayer fp, EditSession editSession, @Selection Region region,
@Arg(desc = "The pattern of blocks to overlay") @Arg(desc = "The pattern of blocks to overlay")
Pattern pattern, InjectedValueAccess context) throws WorldEditException { Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
int affected = editSession.overlayCuboidBlocks(region, pattern); int affected = editSession.overlayCuboidBlocks(region, patternArg);
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -321,8 +317,8 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.overlay") @CommandPermissions("worldedit.region.overlay")
@Logging(REGION) @Logging(REGION)
public void lay(FawePlayer player, EditSession editSession, @Selection Region region, Pattern pattern, InjectedValueAccess context) throws WorldEditException { public void lay(FawePlayer fp, EditSession editSession, @Selection Region region, Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
BlockVector3 max = region.getMaximumPoint(); BlockVector3 max = region.getMaximumPoint();
int maxY = max.getBlockY(); int maxY = max.getBlockY();
Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion(); Iterable<BlockVector2> flat = Regions.asFlatRegion(region).asFlatRegion();
@ -334,10 +330,10 @@ public class RegionCommands {
int x = pos.getBlockX(); int x = pos.getBlockX();
int z = pos.getBlockZ(); int z = pos.getBlockZ();
y = editSession.getNearestSurfaceTerrainBlock(x, z, y, 0, maxY); y = editSession.getNearestSurfaceTerrainBlock(x, z, y, 0, maxY);
editSession.setBlock(x, y, z, pattern); editSession.setBlock(x, y, z, patternArg);
affected++; affected++;
} }
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -350,8 +346,8 @@ public class RegionCommands {
@CommandPermissions("worldedit.region.center") @CommandPermissions("worldedit.region.center")
public void center(Actor actor, EditSession editSession, @Selection Region region, public void center(Actor actor, EditSession editSession, @Selection Region region,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern) throws WorldEditException { Pattern patternArg) throws WorldEditException {
int affected = editSession.center(region, pattern); int affected = editSession.center(region, patternArg);
BBC.VISITOR_BLOCK.send(actor, affected); BBC.VISITOR_BLOCK.send(actor, affected);
} }
@ -361,10 +357,10 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.naturalize") @CommandPermissions("worldedit.region.naturalize")
@Logging(REGION) @Logging(REGION)
public void naturalize(FawePlayer player, EditSession editSession, @Selection Region region, InjectedValueAccess context) throws WorldEditException { public void naturalize(FawePlayer fp, EditSession editSession, @Selection Region region, InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
int affected = editSession.naturalizeCuboidBlocks(region); int affected = editSession.naturalizeCuboidBlocks(region);
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -374,12 +370,12 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.walls") @CommandPermissions("worldedit.region.walls")
@Logging(REGION) @Logging(REGION)
public void walls(FawePlayer player, EditSession editSession, @Selection Region region, public void walls(FawePlayer fp, EditSession editSession, @Selection Region region,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern, InjectedValueAccess context) throws WorldEditException { Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
int affected = editSession.makeWalls(region, pattern); int affected = editSession.makeWalls(region, patternArg);
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -390,12 +386,12 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.faces") @CommandPermissions("worldedit.region.faces")
@Logging(REGION) @Logging(REGION)
public void faces(FawePlayer player, EditSession editSession, @Selection Region region, public void faces(FawePlayer fp, EditSession editSession, @Selection Region region,
@Arg(desc = "The pattern of blocks to set") @Arg(desc = "The pattern of blocks to set")
Pattern pattern, InjectedValueAccess context) throws WorldEditException { Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
int affected = editSession.makeCuboidFaces(region, pattern); int affected = editSession.makeCuboidFaces(region, patternArg);
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -406,7 +402,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.smooth") @CommandPermissions("worldedit.region.smooth")
@Logging(REGION) @Logging(REGION)
public void smooth(FawePlayer player, EditSession editSession, @Selection Region region, public void smooth(FawePlayer fp, EditSession editSession, @Selection Region region,
@Arg(desc = "# of iterations to perform", def = "1") @Arg(desc = "# of iterations to perform", def = "1")
int iterations, int iterations,
@Arg(desc = "The mask of blocks to use as the height map", def = "") @Arg(desc = "The mask of blocks to use as the height map", def = "")
@ -415,16 +411,16 @@ public class RegionCommands {
BlockVector3 min = region.getMinimumPoint(); BlockVector3 min = region.getMinimumPoint();
BlockVector3 max = region.getMaximumPoint(); 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)); 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 = FawePlayer.wrap(player).getLimit(); FaweLimit limit = FawePlayer.wrap(fp).getLimit();
if (volume >= limit.MAX_CHECKS) { if (volume >= limit.MAX_CHECKS) {
throw FaweException.MAX_CHECKS; throw FaweException.MAX_CHECKS;
} }
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
try { try {
HeightMap heightMap = new HeightMap(editSession, region, mask, snow); HeightMap heightMap = new HeightMap(editSession, region, mask, snow);
HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0));
int affected = heightMap.applyFilter(filter, iterations); int affected = heightMap.applyFilter(filter, iterations);
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
} catch (Throwable e) { } catch (Throwable e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@ -470,7 +466,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.move") @CommandPermissions("worldedit.region.move")
@Logging(ORIENTATION_REGION) @Logging(ORIENTATION_REGION)
public void move(FawePlayer player, World world, EditSession editSession, LocalSession session, public void move(FawePlayer fp, World world, EditSession editSession, LocalSession session,
@Selection Region region, @Selection Region region,
@Arg(desc = "# of blocks to move", def = "1") @Arg(desc = "# of blocks to move", def = "1")
int count, int count,
@ -489,7 +485,7 @@ public class RegionCommands {
boolean skipEntities, boolean skipEntities,
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
checkCommandArgument(count >= 1, "Count must be >= 1"); checkCommandArgument(count >= 1, "Count must be >= 1");
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
int affected = editSession.moveRegion(region, direction, count, !ignoreAirBlocks, !skipEntities, copyBiomes, replace); int affected = editSession.moveRegion(region, direction, count, !ignoreAirBlocks, !skipEntities, copyBiomes, replace);
if (moveSelection) { if (moveSelection) {
@ -497,13 +493,13 @@ public class RegionCommands {
region.shift(direction.multiply(count)); region.shift(direction.multiply(count));
session.getRegionSelector(world).learnChanges(); session.getRegionSelector(world).learnChanges();
session.getRegionSelector(world).explainRegionAdjust(player.getPlayer(), session); session.getRegionSelector(world).explainRegionAdjust(fp.getPlayer(), session);
} catch (RegionOperationException e) { } catch (RegionOperationException e) {
player.printError(e.getMessage()); fp.printError(e.getMessage());
} }
} }
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -515,14 +511,14 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.fall") @CommandPermissions("worldedit.region.fall")
@Logging(ORIENTATION_REGION) @Logging(ORIENTATION_REGION)
public void fall(FawePlayer player, EditSession editSession, LocalSession session, public void fall(FawePlayer fp, EditSession editSession, LocalSession session,
@Selection Region region, @Selection Region region,
@Arg(name = "replace", desc = "BlockStateHolder", def = "air") BlockStateHolder replace, @Arg(name = "replace", desc = "BlockStateHolder", def = "air") BlockStateHolder replace,
@Switch(name = 'm', desc = "TODO") boolean notFullHeight, @Switch(name = 'm', desc = "TODO") boolean notFullHeight,
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
int affected = editSession.fall(region, !notFullHeight, replace); int affected = editSession.fall(region, !notFullHeight, replace);
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -532,7 +528,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.stack") @CommandPermissions("worldedit.region.stack")
@Logging(ORIENTATION_REGION) @Logging(ORIENTATION_REGION)
public void stack(FawePlayer player, EditSession editSession, LocalSession session, public void stack(FawePlayer fp, EditSession editSession, LocalSession session,
@Selection Region region, @Selection Region region,
@Arg(desc = "# of copies to stack", def = "1") @Arg(desc = "# of copies to stack", def = "1")
int count, int count,
@ -547,10 +543,10 @@ public class RegionCommands {
boolean skipEntities, boolean skipEntities,
@Switch(name = 'a', desc = "Ignore air blocks") @Switch(name = 'a', desc = "Ignore air blocks")
boolean ignoreAirBlocks, boolean ignoreAirBlocks,
@Switch(name = 'm', desc = "Source mask") @ArgFlag(name = 'm', desc = "Source mask")
Mask sourceMask, Mask sourceMask,
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationStack(() -> { fp.checkConfirmationStack(() -> {
if (sourceMask != null) { if (sourceMask != null) {
editSession.addSourceMask(sourceMask); editSession.addSourceMask(sourceMask);
} }
@ -563,14 +559,14 @@ public class RegionCommands {
final BlockVector3 shiftVector = direction.toVector3().multiply(count * (Math.abs(direction.dot(size)) + 1)).toBlockPoint(); final BlockVector3 shiftVector = direction.toVector3().multiply(count * (Math.abs(direction.dot(size)) + 1)).toBlockPoint();
region.shift(shiftVector); region.shift(shiftVector);
session.getRegionSelector(player.getWorld()).learnChanges(); session.getRegionSelector(fp.getWorld()).learnChanges();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player.getPlayer(), session); session.getRegionSelector(fp.getWorld()).explainRegionAdjust(fp.getPlayer(), session);
} catch (RegionOperationException e) { } catch (RegionOperationException e) {
player.toWorldEditPlayer().printError(e.getMessage()); fp.toWorldEditPlayer().printError(e.getMessage());
} }
} }
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, count, context); }, getArguments(context), region, count, context);
} }
@ -634,27 +630,27 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.regen") @CommandPermissions("worldedit.regen")
@Logging(REGION) @Logging(REGION)
public void regenerateChunk(FawePlayer player, LocalSession session, EditSession editSession, @Selection Region region, public void regenerateChunk(FawePlayer fp, LocalSession session, EditSession editSession, @Selection Region region,
@Arg(def = "", desc = "Regenerate with biome") BiomeType biome, @Arg(def = "", desc = "Regenerate with biome") BiomeType biome,
@Arg(def = "", desc = "Regenerate with seed") Long seed, @Arg(def = "", desc = "Regenerate with seed") Long seed,
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
Mask mask = session.getMask(); Mask mask = session.getMask();
session.setMask((Mask) null); session.setMask((Mask) null);
session.setSourceMask((Mask) null); session.setSourceMask((Mask) null);
editSession.regenerate(region, biome, seed); editSession.regenerate(region, biome, seed);
session.setMask(mask); session.setMask(mask);
session.setSourceMask(mask); session.setSourceMask(mask);
if (!player.hasPermission("fawe.tips")) { if (!fp.hasPermission("fawe.tips")) {
BBC.COMMAND_REGEN_2.send(player); BBC.COMMAND_REGEN_2.send(fp);
} else if (biome == null) { } else if (biome == null) {
BBC.COMMAND_REGEN_0.send(player); BBC.COMMAND_REGEN_0.send(fp);
if (!player.hasPermission("fawe.tips")) BBC.TIP_REGEN_0.send(player); if (!fp.hasPermission("fawe.tips")) BBC.TIP_REGEN_0.send(fp);
} else if (seed == null) { } else if (seed == null) {
BBC.COMMAND_REGEN_1.send(player); BBC.COMMAND_REGEN_1.send(fp);
if (!player.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(player); if (!fp.hasPermission("fawe.tips")) BBC.TIP_REGEN_1.send(fp);
} else { } else {
BBC.COMMAND_REGEN_2.send(player); BBC.COMMAND_REGEN_2.send(fp);
} }
}, getArguments(context), region, context); }, getArguments(context), region, context);
@ -671,19 +667,19 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.hollow") @CommandPermissions("worldedit.region.hollow")
@Logging(REGION) @Logging(REGION)
public void hollow(FawePlayer player, EditSession editSession, public void hollow(FawePlayer fp, EditSession editSession,
@Selection Region region, @Selection Region region,
@Range(min = 0) @Arg(desc = "Thickness of the shell to leave", def = "0") @Range(min = 0) @Arg(desc = "Thickness of the shell to leave", def = "0")
int thickness, int thickness,
@Arg(desc = "The pattern of blocks to replace the hollowed area with", def = "air") @Arg(desc = "The pattern of blocks to replace the hollowed area with", def = "air")
Pattern pattern, Pattern patternArg,
@Switch(name = 'm', desc = "Mask to hollow with") Mask mask, @ArgFlag(name = 'm', desc = "Mask to hollow with") Mask mask,
InjectedValueAccess context) throws WorldEditException { InjectedValueAccess context) throws WorldEditException {
checkCommandArgument(thickness >= 0, "Thickness must be >= 0"); checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask; Mask finalMask = mask == null ? new SolidBlockMask(editSession) : mask;
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
int affected = editSession.hollowOutRegion(region, thickness, pattern, finalMask); int affected = editSession.hollowOutRegion(region, thickness, patternArg, finalMask);
BBC.VISITOR_BLOCK.send(player, affected); BBC.VISITOR_BLOCK.send(fp, affected);
}, getArguments(context), region, context); }, getArguments(context), region, context);
} }
@ -710,19 +706,19 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.flora") @CommandPermissions("worldedit.region.flora")
@Logging(REGION) @Logging(REGION)
public void flora(FawePlayer player, EditSession editSession, @Selection Region region, public void flora(FawePlayer fp, EditSession editSession, @Selection Region region,
@Arg(desc = "The density of the forest", def = "5") @Arg(desc = "The density of the forest", def = "5")
double density, InjectedValueAccess context) throws WorldEditException { double density, InjectedValueAccess context) throws WorldEditException {
checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]"); checkCommandArgument(0 <= density && density <= 100, "Density must be in [0, 100]");
player.checkConfirmationRegion(() -> { fp.checkConfirmationRegion(() -> {
FloraGenerator generator = new FloraGenerator(editSession); FloraGenerator generator = new FloraGenerator(editSession);
GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator); GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator);
LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground);
visitor.setMask(new NoiseFilter2D(new RandomNoise(), density / 100)); visitor.setMask(new NoiseFilter2D(new RandomNoise(), density / 100));
Operations.completeLegacy(visitor); Operations.completeLegacy(visitor);
BBC.COMMAND_FLORA.send(player, ground.getAffected()); BBC.COMMAND_FLORA.send(fp, ground.getAffected());
}, getArguments(context), region, context); }, "/flora", region, context);
} }
} }

View File

@ -62,6 +62,7 @@ import com.sk89q.worldedit.command.NavigationCommands;
import com.sk89q.worldedit.command.NavigationCommandsRegistration; import com.sk89q.worldedit.command.NavigationCommandsRegistration;
import com.sk89q.worldedit.command.PaintBrushCommands; import com.sk89q.worldedit.command.PaintBrushCommands;
import com.sk89q.worldedit.command.PatternCommands; import com.sk89q.worldedit.command.PatternCommands;
import com.sk89q.worldedit.command.PatternCommandsRegistration;
import com.sk89q.worldedit.command.RegionCommands; import com.sk89q.worldedit.command.RegionCommands;
import com.sk89q.worldedit.command.RegionCommandsRegistration; import com.sk89q.worldedit.command.RegionCommandsRegistration;
import com.sk89q.worldedit.command.SchematicCommands; import com.sk89q.worldedit.command.SchematicCommands;
@ -117,7 +118,6 @@ import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
import com.sk89q.worldedit.internal.command.exception.ExceptionConverter; import com.sk89q.worldedit.internal.command.exception.ExceptionConverter;
import com.sk89q.worldedit.internal.command.exception.WorldEditExceptionConverter; import com.sk89q.worldedit.internal.command.exception.WorldEditExceptionConverter;
import com.sk89q.worldedit.internal.util.Substring; import com.sk89q.worldedit.internal.util.Substring;
import com.sk89q.worldedit.scripting.CommandScriptLoader;
import com.sk89q.worldedit.session.request.Request; import com.sk89q.worldedit.session.request.Request;
import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.util.eventbus.Subscribe; import com.sk89q.worldedit.util.eventbus.Subscribe;
@ -256,14 +256,14 @@ public final class PlatformCommandManager {
public void registerAlwaysInjectedValues() { public void registerAlwaysInjectedValues() {
globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of); globalInjectedValues.injectValue(Key.of(InjectedValueAccess.class), Optional::of);
register(new AnnotatedBindings(worldEdit)); registerBinding(new AnnotatedBindings(worldEdit));
register(new CommandBindings(worldEdit)); registerBinding(new CommandBindings(worldEdit));
register(new ConsumeBindings(worldEdit)); registerBinding(new ConsumeBindings(worldEdit));
register(new ProvideBindings(worldEdit)); registerBinding(new ProvideBindings(worldEdit));
register(new ProvideBindings(worldEdit)); registerBinding(new ProvideBindings(worldEdit));
} }
public void register(Object classWithMethods) { public void registerBinding(Object classWithMethods) {
// TODO NOT IMPLEMENTED - register the following using a custom processor / annotations // TODO NOT IMPLEMENTED - register the following using a custom processor / annotations
} }
@ -299,6 +299,10 @@ public final class PlatformCommandManager {
}); });
} }
public void getCommand(String arguments) {
}
public void registerAllCommands() { public void registerAllCommands() {
if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) { if (Settings.IMP.ENABLED_COMPONENTS.COMMANDS) {
// TODO NOT IMPLEMENTED dunno why these have issues generating // TODO NOT IMPLEMENTED dunno why these have issues generating
@ -412,11 +416,6 @@ public final class PlatformCommandManager {
GenerationCommandsRegistration.builder(), GenerationCommandsRegistration.builder(),
new GenerationCommands(worldEdit) new GenerationCommands(worldEdit)
); );
this.registration.register(
new CFICommand(commandManager),
CFICommandsRegistration.builder(),
new CFICommands(worldEdit)
);
this.registration.register( this.registration.register(
commandManager, commandManager,
HistoryCommandsRegistration.builder(), HistoryCommandsRegistration.builder(),
@ -535,7 +534,7 @@ public final class PlatformCommandManager {
// Delay command registration to allow time for other plugins to hook into FAWE // Delay command registration to allow time for other plugins to hook into FAWE
try { try {
new CommandScriptLoader().load(); // new CommandScriptLoader().load();
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -564,6 +563,7 @@ public final class PlatformCommandManager {
} }
platform.registerCommands(commandManager); platform.registerCommands(commandManager);
// commandManager.getCommand("pattern").get()
} }
void removeCommands() { void removeCommands() {

View File

@ -52,7 +52,6 @@ import com.sk89q.worldedit.registry.state.PropertyGroup;
import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.session.ClipboardHolder;
import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Countable;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockState;
@ -65,6 +64,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
@ -136,6 +136,15 @@ public interface Extent extends InputExtent, OutputExtent {
return null; return null;
} }
/**
* Create an entity at the given location.
*
* @param entity the entity
* @param location the location
* @return a reference to the created entity, or null if the entity could not be created
*/
default @Nullable void removeEntity(int x, int y, int z, UUID uuid) {}
/* /*
Queue based methods Queue based methods
TODO NOT IMPLEMENTED: TODO NOT IMPLEMENTED:
@ -620,8 +629,4 @@ public interface Extent extends InputExtent, OutputExtent {
return count; return count;
} }
default World getWorld() {
return null;
}
} }

View File

@ -20,8 +20,12 @@
package com.sk89q.worldedit.function.mask; package com.sk89q.worldedit.function.mask;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.Region;
import javax.annotation.Nullable;
import javax.annotation.Nullable;
/** /**
* A mask that tests whether given positions are contained within a region. * A mask that tests whether given positions are contained within a region.