geforkt von Mirrors/FastAsyncWorldEdit
Selective merge of commanding branch.
Dieser Commit ist enthalten in:
Ursprung
8768085479
Commit
fd408c64ed
@ -6,8 +6,7 @@ import com.boydti.fawe.util.MathMan;
|
|||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.MutableBlockVector3;
|
import com.sk89q.worldedit.math.MutableBlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.Raster;
|
import java.awt.image.Raster;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -79,7 +78,7 @@ public class ScalableHeightMap implements HeightMap {
|
|||||||
MutableBlockVector3 bv = new MutableBlockVector3(pos);
|
MutableBlockVector3 bv = new MutableBlockVector3(pos);
|
||||||
for (int y = minY; y <= maxY; y++) {
|
for (int y = minY; y <= maxY; y++) {
|
||||||
bv.mutY(y);
|
bv.mutY(y);
|
||||||
BlockStateHolder block = clipboard.getBlock(bv);
|
BlockState block = clipboard.getBlock(bv);
|
||||||
if (!block.getBlockType().getMaterial().isAir()) {
|
if (!block.getBlockType().getMaterial().isAir()) {
|
||||||
highestY = y + 1;
|
highestY = y + 1;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,17 @@ public abstract class FaweClipboard {
|
|||||||
|
|
||||||
public abstract <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block);
|
public abstract <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block);
|
||||||
|
|
||||||
public abstract boolean hasBiomes();
|
/**
|
||||||
|
* Returns true if the clipboard has biome data. This can be checked since {@link Extent#getBiome(BlockVector2)}
|
||||||
|
* strongly suggests returning {@link com.sk89q.worldedit.world.biome.BiomeTypes#OCEAN} instead of {@code null}
|
||||||
|
* if biomes aren't present. However, it might not be desired to set areas to ocean if the clipboard is defaulting
|
||||||
|
* to ocean, instead of having biomes explicitly set.
|
||||||
|
*
|
||||||
|
* @return true if the clipboard has biome data set
|
||||||
|
*/
|
||||||
|
public boolean hasBiomes() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract boolean setBiome(int x, int z, BiomeType biome);
|
public abstract boolean setBiome(int x, int z, BiomeType biome);
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ public class ClipboardCommands {
|
|||||||
BBC.COMMAND_PASTE.send(actor, to);
|
BBC.COMMAND_PASTE.send(actor, to);
|
||||||
|
|
||||||
if (!actor.hasPermission("fawe.tips")) {
|
if (!actor.hasPermission("fawe.tips")) {
|
||||||
BBC.TIP_COPYPASTE.send(actor);
|
actor.print(BBC.TIP_COPYPASTE.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,10 +144,10 @@ public class GeneralCommands {
|
|||||||
}
|
}
|
||||||
if (hasFastMode) {
|
if (hasFastMode) {
|
||||||
session.setFastMode(false);
|
session.setFastMode(false);
|
||||||
BBC.FAST_DISABLED.send(actor);
|
actor.print(BBC.FAST_DISABLED.s());
|
||||||
} else {
|
} else {
|
||||||
session.setFastMode(true);
|
session.setFastMode(true);
|
||||||
BBC.FAST_ENABLED.send(actor);
|
actor.print(BBC.FAST_ENABLED.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,9 +219,9 @@ public class GeneralCommands {
|
|||||||
public void gmask(Actor actor, LocalSession session, @Arg(desc = "The mask to set", def = "") Mask mask) {
|
public void gmask(Actor actor, LocalSession session, @Arg(desc = "The mask to set", def = "") Mask mask) {
|
||||||
session.setMask(mask);
|
session.setMask(mask);
|
||||||
if (mask == null) {
|
if (mask == null) {
|
||||||
BBC.MASK_DISABLED.send(actor);
|
actor.print(BBC.MASK_DISABLED.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.MASK.send(actor);
|
actor.print(BBC.MASK.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,9 +232,9 @@ public class GeneralCommands {
|
|||||||
)
|
)
|
||||||
public void togglePlace(Player player, LocalSession session) {
|
public void togglePlace(Player player, LocalSession session) {
|
||||||
if (session.togglePlacementPosition()) {
|
if (session.togglePlacementPosition()) {
|
||||||
BBC.PLACE_ENABLED.send(player);
|
player.print(BBC.PLACE_ENABLED.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.PLACE_DISABLED.send(player);
|
player.print(BBC.PLACE_DISABLED.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,9 @@ public class GenerationCommands {
|
|||||||
BlockVector3 finalPos = raised ? pos.add(0, radii.getY(), 0) : pos;
|
BlockVector3 finalPos = raised ? pos.add(0, radii.getY(), 0) : pos;
|
||||||
actor.checkConfirmationRadius(() -> {
|
actor.checkConfirmationRadius(() -> {
|
||||||
int affected = editSession.makeSphere(finalPos, pattern, radii.getX(), radii.getY(), radii.getZ(), !hollow);
|
int affected = editSession.makeSphere(finalPos, pattern, radii.getX(), radii.getY(), radii.getZ(), !hollow);
|
||||||
if (actor instanceof Player) ((Player) actor).findFreePosition();
|
if (actor instanceof Player) {
|
||||||
|
((Player) actor).findFreePosition();
|
||||||
|
}
|
||||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, "sphere", (int) max, context);
|
}, "sphere", (int) max, context);
|
||||||
}
|
}
|
||||||
@ -336,7 +338,9 @@ public class GenerationCommands {
|
|||||||
worldEdit.checkMaxRadius(size);
|
worldEdit.checkMaxRadius(size);
|
||||||
actor.checkConfirmationRadius(() -> {
|
actor.checkConfirmationRadius(() -> {
|
||||||
int affected = editSession.makePyramid(pos, pattern, size, !hollow);
|
int affected = editSession.makePyramid(pos, pattern, size, !hollow);
|
||||||
if (actor instanceof Player) ((Player) actor).findFreePosition();
|
if (actor instanceof Player) {
|
||||||
|
((Player) actor).findFreePosition();
|
||||||
|
}
|
||||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, getArguments(context), size, context);
|
}, getArguments(context), size, context);
|
||||||
}
|
}
|
||||||
@ -397,7 +401,9 @@ public class GenerationCommands {
|
|||||||
actor.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
try {
|
try {
|
||||||
final int affected = editSession.makeShape(region, zero, unit1, pattern, String.join(" ", expression), hollow, session.getTimeout());
|
final int affected = editSession.makeShape(region, zero, unit1, pattern, String.join(" ", expression), hollow, session.getTimeout());
|
||||||
if (actor instanceof Player) ((Player) actor).findFreePosition();
|
if (actor instanceof Player) {
|
||||||
|
((Player) actor).findFreePosition();
|
||||||
|
}
|
||||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
} catch (ExpressionException e) {
|
} catch (ExpressionException e) {
|
||||||
actor.printError(e.getMessage());
|
actor.printError(e.getMessage());
|
||||||
|
@ -41,6 +41,7 @@ import com.sk89q.worldedit.WorldEditException;
|
|||||||
import com.sk89q.worldedit.command.util.CommandPermissions;
|
import com.sk89q.worldedit.command.util.CommandPermissions;
|
||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.internal.annotation.Range;
|
import com.sk89q.worldedit.internal.annotation.Range;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.regions.Region;
|
import com.sk89q.worldedit.regions.Region;
|
||||||
@ -232,7 +233,7 @@ public class HistoryCommands {
|
|||||||
times = Math.max(1, times);
|
times = Math.max(1, times);
|
||||||
LocalSession undoSession;
|
LocalSession undoSession;
|
||||||
if (session.hasFastMode()) {
|
if (session.hasFastMode()) {
|
||||||
BBC.COMMAND_UNDO_DISABLED.send(player);
|
player.print(BBC.COMMAND_UNDO_DISABLED.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (playerName != null && !playerName.isEmpty()) {
|
if (playerName != null && !playerName.isEmpty()) {
|
||||||
@ -259,7 +260,7 @@ public class HistoryCommands {
|
|||||||
worldEdit.flushBlockBag(player, undone);
|
worldEdit.flushBlockBag(player, undone);
|
||||||
}
|
}
|
||||||
if (undone == null) {
|
if (undone == null) {
|
||||||
BBC.COMMAND_UNDO_ERROR.send(player);
|
player.printError(BBC.COMMAND_UNDO_ERROR.s());
|
||||||
}
|
}
|
||||||
}, "undo", times, 50, context);
|
}, "undo", times, 50, context);
|
||||||
}
|
}
|
||||||
@ -298,7 +299,7 @@ public class HistoryCommands {
|
|||||||
if (timesRedone > 0) {
|
if (timesRedone > 0) {
|
||||||
BBC.COMMAND_REDO_SUCCESS.send(player, timesRedone == 1 ? "" : " x" + timesRedone);
|
BBC.COMMAND_REDO_SUCCESS.send(player, timesRedone == 1 ? "" : " x" + timesRedone);
|
||||||
} else {
|
} else {
|
||||||
BBC.COMMAND_REDO_ERROR.send(player);
|
player.printError(BBC.COMMAND_REDO_ERROR.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,9 +309,9 @@ public class HistoryCommands {
|
|||||||
desc = "Clear your history"
|
desc = "Clear your history"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.history.clear")
|
@CommandPermissions("worldedit.history.clear")
|
||||||
public void clearHistory(Player player, LocalSession session) {
|
public void clearHistory(Actor actor, LocalSession session) {
|
||||||
session.clearHistory();
|
session.clearHistory();
|
||||||
BBC.COMMAND_HISTORY_CLEAR.send(player);
|
actor.print(BBC.COMMAND_HISTORY_CLEAR.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class NavigationCommands {
|
|||||||
@CommandPermissions("worldedit.navigation.unstuck")
|
@CommandPermissions("worldedit.navigation.unstuck")
|
||||||
public void unstuck(Player player) throws WorldEditException {
|
public void unstuck(Player player) throws WorldEditException {
|
||||||
player.findFreePosition();
|
player.findFreePosition();
|
||||||
BBC.UNSTUCK.send(player);
|
player.print(BBC.UNSTUCK.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -82,10 +82,10 @@ public class NavigationCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ascentLevels == 0) {
|
if (ascentLevels == 0) {
|
||||||
BBC.ASCEND_FAIL.send(player);
|
player.printError(BBC.ASCEND_FAIL.s());
|
||||||
} else {
|
} else {
|
||||||
if (ascentLevels == 1) {
|
if (ascentLevels == 1) {
|
||||||
BBC.ASCENDED_SINGULAR.send(player);
|
player.print(BBC.ASCENDED_SINGULAR.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.ASCENDED_PLURAL.send(player, ascentLevels);
|
BBC.ASCENDED_PLURAL.send(player, ascentLevels);
|
||||||
}
|
}
|
||||||
@ -109,9 +109,9 @@ public class NavigationCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (descentLevels == 0) {
|
if (descentLevels == 0) {
|
||||||
BBC.DESCEND_FAIL.send(player);
|
player.printError(BBC.DESCEND_FAIL.s());
|
||||||
} else if (descentLevels == 1) {
|
} else if (descentLevels == 1) {
|
||||||
BBC.DESCEND_SINGULAR.send(player);
|
player.print(BBC.DESCEND_SINGULAR.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.DESCEND_PLURAL.send(player, descentLevels);
|
BBC.DESCEND_PLURAL.send(player, descentLevels);
|
||||||
}
|
}
|
||||||
@ -134,9 +134,9 @@ public class NavigationCommands {
|
|||||||
|
|
||||||
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
|
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
|
||||||
if (player.ascendToCeiling(clearance, alwaysGlass)) {
|
if (player.ascendToCeiling(clearance, alwaysGlass)) {
|
||||||
BBC.WHOOSH.send(player);
|
player.print(BBC.WHOOSH.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.ASCEND_FAIL.send(player);
|
player.printError(BBC.ASCEND_FAIL.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,9 +147,9 @@ public class NavigationCommands {
|
|||||||
@CommandPermissions("worldedit.navigation.thru.command")
|
@CommandPermissions("worldedit.navigation.thru.command")
|
||||||
public void thru(Player player) throws WorldEditException {
|
public void thru(Player player) throws WorldEditException {
|
||||||
if (player.passThroughForwardWall(6)) {
|
if (player.passThroughForwardWall(6)) {
|
||||||
BBC.WHOOSH.send(player);
|
player.print(BBC.WHOOSH.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.THRU_FAIL.send(player);
|
player.printError(BBC.THRU_FAIL.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,9 +174,9 @@ public class NavigationCommands {
|
|||||||
} else {
|
} else {
|
||||||
player.findFreePosition(pos);
|
player.findFreePosition(pos);
|
||||||
}
|
}
|
||||||
BBC.POOF.send(player);
|
player.print(BBC.POOF.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.NO_BLOCK.send(player);
|
player.printError(BBC.NO_BLOCK.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,9 +195,9 @@ public class NavigationCommands {
|
|||||||
boolean forceGlass) throws WorldEditException {
|
boolean forceGlass) throws WorldEditException {
|
||||||
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
|
boolean alwaysGlass = getAlwaysGlass(forceFlight, forceGlass);
|
||||||
if (player.ascendUpwards(distance, alwaysGlass)) {
|
if (player.ascendUpwards(distance, alwaysGlass)) {
|
||||||
BBC.WHOOSH.send(player);
|
player.print(BBC.WHOOSH.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.UP_FAIL.send(player);
|
player.printError(BBC.UP_FAIL.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ import com.boydti.fawe.FaweAPI;
|
|||||||
import com.boydti.fawe.FaweCache;
|
import com.boydti.fawe.FaweCache;
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.object.FaweLimit;
|
import com.boydti.fawe.object.FaweLimit;
|
||||||
import com.boydti.fawe.object.exception.FaweException;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
@ -108,16 +107,16 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.set")
|
@CommandPermissions("worldedit.region.set")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void set(Player fp, EditSession editSession,
|
public void set(Actor actor, 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 patternArg, InjectedValueAccess context) throws WorldEditException {
|
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.setBlocks(region, patternArg);
|
int affected = editSession.setBlocks(region, pattern);
|
||||||
if (affected != 0) {
|
if (affected != 0) {
|
||||||
BBC.OPERATION.send(fp, affected);
|
BBC.OPERATION.send(actor, affected);
|
||||||
if (!fp.hasPermission("fawe.tips"))
|
if (!actor.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(fp);
|
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(actor);
|
||||||
}
|
}
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
@ -215,7 +214,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 patternArgOpt,
|
Pattern pattern,
|
||||||
@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")
|
||||||
@ -229,7 +228,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(patternArgOpt, pos1, pos2, thickness, !shell);
|
int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell);
|
||||||
|
|
||||||
BBC.VISITOR_BLOCK.send(actor, blocksChanged);
|
BBC.VISITOR_BLOCK.send(actor, blocksChanged);
|
||||||
return blocksChanged;
|
return blocksChanged;
|
||||||
@ -242,27 +241,27 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.curve")
|
@CommandPermissions("worldedit.region.curve")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void curve(Player fp, EditSession editSession,
|
public void curve(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 patternArg,
|
Pattern pattern,
|
||||||
@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)) {
|
||||||
fp.printError("//curve only works with convex polyhedral selections");
|
actor.printError("//curve only works with convex polyhedral selections");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
|
||||||
|
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.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(patternArg, vectors, 0, 0, 0, 10, thickness, !shell);
|
int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
|
||||||
|
|
||||||
BBC.VISITOR_BLOCK.send(fp, blocksChanged);
|
BBC.VISITOR_BLOCK.send(actor, blocksChanged);
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +272,7 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.replace")
|
@CommandPermissions("worldedit.region.replace")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void replace(Player fp, EditSession editSession, @Selection Region region,
|
public void replace(Actor actor, 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,14 +281,14 @@ public class RegionCommands {
|
|||||||
from = new ExistingBlockMask(editSession);
|
from = new ExistingBlockMask(editSession);
|
||||||
}
|
}
|
||||||
Mask finalFrom = from;
|
Mask finalFrom = from;
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.replaceBlocks(region, finalFrom, to);
|
int affected = editSession.replaceBlocks(region, finalFrom, to);
|
||||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
if (!fp.hasPermission("fawe.tips")) {
|
if (!actor.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(fp);
|
BBC.TIP_REPLACE_REGEX_4, BBC.TIP_REPLACE_REGEX_5).send(actor);
|
||||||
}
|
}
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
@ -300,12 +299,12 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.overlay")
|
@CommandPermissions("worldedit.region.overlay")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void overlay(Player fp, EditSession editSession, @Selection Region region,
|
public void overlay(Actor actor, EditSession editSession, @Selection Region region,
|
||||||
@Arg(desc = "The pattern of blocks to overlay")
|
@Arg(desc = "The pattern of blocks to overlay")
|
||||||
Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.overlayCuboidBlocks(region, patternArg);
|
int affected = editSession.overlayCuboidBlocks(region, pattern);
|
||||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,8 +343,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 patternArg) throws WorldEditException {
|
Pattern pattern) throws WorldEditException {
|
||||||
int affected = editSession.center(region, patternArg);
|
int affected = editSession.center(region, pattern);
|
||||||
BBC.VISITOR_BLOCK.send(actor, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,10 +354,10 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.naturalize")
|
@CommandPermissions("worldedit.region.naturalize")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void naturalize(Player fp, EditSession editSession, @Selection Region region, InjectedValueAccess context) throws WorldEditException {
|
public void naturalize(Actor actor, EditSession editSession, @Selection Region region, InjectedValueAccess context) throws WorldEditException {
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.naturalizeCuboidBlocks(region);
|
int affected = editSession.naturalizeCuboidBlocks(region);
|
||||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,12 +367,12 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.walls")
|
@CommandPermissions("worldedit.region.walls")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void walls(Player fp, EditSession editSession, @Selection Region region,
|
public void walls(Actor actor, EditSession editSession, @Selection Region region,
|
||||||
@Arg(desc = "The pattern of blocks to set")
|
@Arg(desc = "The pattern of blocks to set")
|
||||||
Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.makeWalls(region, patternArg);
|
int affected = editSession.makeWalls(region, pattern);
|
||||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,12 +383,12 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.faces")
|
@CommandPermissions("worldedit.region.faces")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void faces(Player fp, EditSession editSession, @Selection Region region,
|
public void faces(Actor actor, EditSession editSession, @Selection Region region,
|
||||||
@Arg(desc = "The pattern of blocks to set")
|
@Arg(desc = "The pattern of blocks to set")
|
||||||
Pattern patternArg, InjectedValueAccess context) throws WorldEditException {
|
Pattern pattern, InjectedValueAccess context) throws WorldEditException {
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.makeCuboidFaces(region, patternArg);
|
int affected = editSession.makeCuboidFaces(region, pattern);
|
||||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,25 +399,25 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.smooth")
|
@CommandPermissions("worldedit.region.smooth")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void smooth(Player fp, EditSession editSession, @Selection Region region,
|
public void smooth(Actor actor, 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 = "")
|
||||||
Mask maskOpt,
|
Mask mask,
|
||||||
@Switch(name = 's', desc = "TODO") boolean snow, InjectedValueAccess context) throws WorldEditException {
|
@Switch(name = 's', desc = "TODO") boolean snow, InjectedValueAccess context) throws WorldEditException {
|
||||||
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 = fp.getLimit();
|
FaweLimit limit = actor.getLimit();
|
||||||
if (volume >= limit.MAX_CHECKS) {
|
if (volume >= limit.MAX_CHECKS) {
|
||||||
throw FaweCache.MAX_CHECKS;
|
throw FaweCache.MAX_CHECKS;
|
||||||
}
|
}
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
try {
|
try {
|
||||||
HeightMap heightMap = new HeightMap(editSession, region, maskOpt, 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(fp, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
@ -432,11 +431,11 @@ public class RegionCommands {
|
|||||||
descFooter = "Bypass region restrictions"
|
descFooter = "Bypass region restrictions"
|
||||||
)
|
)
|
||||||
@CommandPermissions("fawe.admin")
|
@CommandPermissions("fawe.admin")
|
||||||
public void wea(Player player) throws WorldEditException {
|
public void wea(Actor actor) throws WorldEditException {
|
||||||
if (player.togglePermission("fawe.bypass")) {
|
if (actor.togglePermission("fawe.bypass")) {
|
||||||
BBC.WORLDEDIT_BYPASSED.send(player);
|
actor.print(BBC.WORLDEDIT_BYPASSED.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.WORLDEDIT_RESTRICTED.send(player);
|
actor.print(BBC.WORLDEDIT_RESTRICTED.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -447,13 +446,13 @@ public class RegionCommands {
|
|||||||
descFooter = "Select your current allowed region"
|
descFooter = "Select your current allowed region"
|
||||||
)
|
)
|
||||||
@CommandPermissions("fawe.worldeditregion")
|
@CommandPermissions("fawe.worldeditregion")
|
||||||
public void wer(Player fp) throws WorldEditException {
|
public void wer(Player player) throws WorldEditException {
|
||||||
final Region region = fp.getLargestRegion();
|
final Region region = player.getLargestRegion();
|
||||||
if (region == null) {
|
if (region == null) {
|
||||||
BBC.NO_REGION.send(fp);
|
player.print(BBC.NO_REGION.s());
|
||||||
} else {
|
} else {
|
||||||
fp.setSelection(region);
|
player.setSelection(region);
|
||||||
BBC.SET_REGION.send(fp);
|
player.print(BBC.SET_REGION.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +463,7 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.move")
|
@CommandPermissions("worldedit.region.move")
|
||||||
@Logging(ORIENTATION_REGION)
|
@Logging(ORIENTATION_REGION)
|
||||||
public void move(Player player, World world, EditSession editSession, LocalSession session,
|
public void move(Actor actor, 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,
|
||||||
@ -483,7 +482,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(() -> {
|
actor.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) {
|
||||||
@ -491,13 +490,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, session);
|
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||||
} catch (RegionOperationException e) {
|
} catch (RegionOperationException e) {
|
||||||
player.printError(e.getMessage());
|
actor.printError(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BBC.VISITOR_BLOCK.send(player, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,7 +510,7 @@ public class RegionCommands {
|
|||||||
@Logging(ORIENTATION_REGION)
|
@Logging(ORIENTATION_REGION)
|
||||||
public void fall(Player player, EditSession editSession, LocalSession session,
|
public void fall(Player player, EditSession editSession, LocalSession session,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(name = "replace", desc = "BlockStateHolder", def = "air") BlockStateHolder replace,
|
@Arg(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(() -> {
|
player.checkConfirmationRegion(() -> {
|
||||||
@ -526,7 +525,7 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.stack")
|
@CommandPermissions("worldedit.region.stack")
|
||||||
@Logging(ORIENTATION_REGION)
|
@Logging(ORIENTATION_REGION)
|
||||||
public void stack(Player player, EditSession editSession, LocalSession session,
|
public void stack(Actor actor, World world, 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,
|
||||||
@ -544,7 +543,7 @@ public class RegionCommands {
|
|||||||
@ArgFlag(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(() -> {
|
actor.checkConfirmationStack(() -> {
|
||||||
if (sourceMask != null) {
|
if (sourceMask != null) {
|
||||||
editSession.addSourceMask(sourceMask);
|
editSession.addSourceMask(sourceMask);
|
||||||
}
|
}
|
||||||
@ -557,14 +556,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(world).learnChanges();
|
||||||
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
|
session.getRegionSelector(world).explainRegionAdjust(actor, session);
|
||||||
} catch (RegionOperationException e) {
|
} catch (RegionOperationException e) {
|
||||||
player.printError(e.getMessage());
|
actor.printError(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BBC.VISITOR_BLOCK.send(player, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, getArguments(context), region, count, context);
|
}, getArguments(context), region, count, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -577,7 +576,7 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.deform")
|
@CommandPermissions("worldedit.region.deform")
|
||||||
@Logging(ALL)
|
@Logging(ALL)
|
||||||
public void deform(Player player, LocalSession session, EditSession editSession, InjectedValueAccess context,
|
public void deform(Actor actor, LocalSession session, EditSession editSession, InjectedValueAccess context,
|
||||||
@Selection Region region,
|
@Selection Region region,
|
||||||
@Arg(desc = "The expression to use", variable = true)
|
@Arg(desc = "The expression to use", variable = true)
|
||||||
List<String> expression,
|
List<String> expression,
|
||||||
@ -592,7 +591,7 @@ public class RegionCommands {
|
|||||||
zero = Vector3.ZERO;
|
zero = Vector3.ZERO;
|
||||||
unit = Vector3.ONE;
|
unit = Vector3.ONE;
|
||||||
} else if (offset) {
|
} else if (offset) {
|
||||||
zero = session.getPlacementPosition(player).toVector3();
|
zero = session.getPlacementPosition(actor).toVector3();
|
||||||
unit = Vector3.ONE;
|
unit = Vector3.ONE;
|
||||||
} else {
|
} else {
|
||||||
final Vector3 min = region.getMinimumPoint().toVector3();
|
final Vector3 min = region.getMinimumPoint().toVector3();
|
||||||
@ -607,13 +606,15 @@ public class RegionCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Vector3 unit1 = unit;
|
final Vector3 unit1 = unit;
|
||||||
player.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
try {
|
try {
|
||||||
final int affected = editSession.deformRegion(region, zero, unit1, String.join(" ", expression), session.getTimeout());
|
final int affected = editSession.deformRegion(region, zero, unit1, String.join(" ", expression), session.getTimeout());
|
||||||
player.findFreePosition();
|
if (actor instanceof Player) {
|
||||||
BBC.VISITOR_BLOCK.send(player, affected);
|
((Player) actor).findFreePosition();
|
||||||
|
}
|
||||||
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
} catch (ExpressionException e) {
|
} catch (ExpressionException e) {
|
||||||
player.printError(e.getMessage());
|
actor.printError(e.getMessage());
|
||||||
}
|
}
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
@ -665,19 +666,19 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.hollow")
|
@CommandPermissions("worldedit.region.hollow")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void hollow(Player fp, EditSession editSession,
|
public void hollow(Actor actor, 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(name = "pattern", 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 patternArgOpt,
|
Pattern pattern,
|
||||||
@ArgFlag(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;
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.checkConfirmationRegion(() -> {
|
||||||
int affected = editSession.hollowOutRegion(region, thickness, patternArgOpt, finalMask);
|
int affected = editSession.hollowOutRegion(region, thickness, pattern, finalMask);
|
||||||
BBC.VISITOR_BLOCK.send(fp, affected);
|
BBC.VISITOR_BLOCK.send(actor, affected);
|
||||||
}, getArguments(context), region, context);
|
}, getArguments(context), region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -704,18 +705,18 @@ public class RegionCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.region.flora")
|
@CommandPermissions("worldedit.region.flora")
|
||||||
@Logging(REGION)
|
@Logging(REGION)
|
||||||
public void flora(Player fp, EditSession editSession, @Selection Region region,
|
public void flora(Actor actor, 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]");
|
||||||
fp.checkConfirmationRegion(() -> {
|
actor.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(fp, ground.getAffected());
|
BBC.COMMAND_FLORA.send(actor, ground.getAffected());
|
||||||
}, "/flora", region, context);
|
}, "/flora", region, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.command;
|
package com.sk89q.worldedit.command;
|
||||||
|
|
||||||
|
import static com.boydti.fawe.util.ReflectionUtils.as;
|
||||||
|
import static com.google.common.base.Preconditions.checkArgument;
|
||||||
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
import com.boydti.fawe.config.BBC;
|
import com.boydti.fawe.config.BBC;
|
||||||
import com.boydti.fawe.config.Settings;
|
import com.boydti.fawe.config.Settings;
|
||||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||||
@ -59,16 +63,6 @@ import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
|
|||||||
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
import com.sk89q.worldedit.util.formatting.text.format.TextColor;
|
||||||
import com.sk89q.worldedit.util.io.Closer;
|
import com.sk89q.worldedit.util.io.Closer;
|
||||||
import com.sk89q.worldedit.util.io.file.FilenameException;
|
import com.sk89q.worldedit.util.io.file.FilenameException;
|
||||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
|
||||||
import org.enginehub.piston.annotation.Command;
|
|
||||||
import org.enginehub.piston.annotation.CommandContainer;
|
|
||||||
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.exception.StopExecutionException;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -91,10 +85,14 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import org.enginehub.piston.annotation.Command;
|
||||||
import static com.boydti.fawe.util.ReflectionUtils.as;
|
import org.enginehub.piston.annotation.CommandContainer;
|
||||||
import static com.google.common.base.Preconditions.checkArgument;
|
import org.enginehub.piston.annotation.param.Arg;
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import org.enginehub.piston.annotation.param.ArgFlag;
|
||||||
|
import org.enginehub.piston.annotation.param.Switch;
|
||||||
|
import org.enginehub.piston.exception.StopExecutionException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
//import com.boydti.fawe.object.schematic.visualizer.SchemVis;
|
//import com.boydti.fawe.object.schematic.visualizer.SchemVis;
|
||||||
|
|
||||||
@ -579,15 +577,17 @@ public class SchematicCommands {
|
|||||||
descFooter = "Note: Format is not fully verified until loading."
|
descFooter = "Note: Format is not fully verified until loading."
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.schematic.list")
|
@CommandPermissions("worldedit.schematic.list")
|
||||||
public void list(Actor actor, LocalSession session, @Arg(name = "filter", desc = "Filter for schematics", def = "all")
|
public void list(Actor actor, LocalSession session,
|
||||||
String filter, @ArgFlag(name = 'f', desc = "Restricts by format.", def = "")
|
|
||||||
String formatName,
|
|
||||||
@ArgFlag(name = 'p', desc = "Page to view.", def = "-1")
|
@ArgFlag(name = 'p', desc = "Page to view.", def = "-1")
|
||||||
int page,
|
int page,
|
||||||
@Switch(name = 'd', desc = "Sort by date, oldest first")
|
@Switch(name = 'd', desc = "Sort by date, oldest first")
|
||||||
boolean oldFirst,
|
boolean oldFirst,
|
||||||
@Switch(name = 'n', desc = "Sort by date, newest first")
|
@Switch(name = 'n', desc = "Sort by date, newest first")
|
||||||
boolean newFirst,
|
boolean newFirst,
|
||||||
|
@ArgFlag(name = 'f', desc = "Restricts by format.")
|
||||||
|
String formatName,
|
||||||
|
@Arg(name = "filter", desc = "Filter for schematics", def = "all")
|
||||||
|
String filter,
|
||||||
Arguments arguments
|
Arguments arguments
|
||||||
) throws WorldEditException {
|
) throws WorldEditException {
|
||||||
if (oldFirst && newFirst) {
|
if (oldFirst && newFirst) {
|
||||||
|
@ -117,7 +117,7 @@ public class SelectionCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!session.getRegionSelector(world).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
if (!session.getRegionSelector(world).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
||||||
actor.print(BBC.SELECTOR_ALREADY_SET.s());
|
actor.printError(BBC.SELECTOR_ALREADY_SET.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ public class SelectionCommands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!session.getRegionSelector(world).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
if (!session.getRegionSelector(world).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(actor))) {
|
||||||
actor.print(BBC.SELECTOR_ALREADY_SET.s());
|
actor.printError(BBC.SELECTOR_ALREADY_SET.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,14 +165,14 @@ public class SelectionCommands {
|
|||||||
|
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||||
player.print(BBC.SELECTOR_ALREADY_SET.s());
|
player.printError(BBC.SELECTOR_ALREADY_SET.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld())
|
session.getRegionSelector(player.getWorld())
|
||||||
.explainPrimarySelection(player, session, pos.toBlockPoint());
|
.explainPrimarySelection(player, session, pos.toBlockPoint());
|
||||||
} else {
|
} else {
|
||||||
player.print(BBC.NO_BLOCK.s());
|
player.printError(BBC.NO_BLOCK.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,14 +187,14 @@ public class SelectionCommands {
|
|||||||
|
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos.toBlockPoint(), ActorSelectorLimits.forActor(player))) {
|
||||||
player.print(BBC.SELECTOR_ALREADY_SET.s());
|
player.printError(BBC.SELECTOR_ALREADY_SET.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.getRegionSelector(player.getWorld())
|
session.getRegionSelector(player.getWorld())
|
||||||
.explainSecondarySelection(player, session, pos.toBlockPoint());
|
.explainSecondarySelection(player, session, pos.toBlockPoint());
|
||||||
} else {
|
} else {
|
||||||
player.print(BBC.NO_BLOCK.s());
|
player.printError(BBC.NO_BLOCK.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class SnapshotCommands {
|
|||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
if (config.snapshotRepo == null) {
|
if (config.snapshotRepo == null) {
|
||||||
BBC.SNAPSHOT_NOT_CONFIGURED.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_CONFIGURED.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ public class SnapshotCommands {
|
|||||||
if (!snapshots.isEmpty()) {
|
if (!snapshots.isEmpty()) {
|
||||||
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
|
actor.print(new SnapshotListBox(world.getName(), snapshots).create(page));
|
||||||
} else {
|
} else {
|
||||||
BBC.SNAPSHOT_NOT_AVAILABLE.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_AVAILABLE.s());
|
||||||
|
|
||||||
// Okay, let's toss some debugging information!
|
// Okay, let's toss some debugging information!
|
||||||
File dir = config.snapshotRepo.getDirectory();
|
File dir = config.snapshotRepo.getDirectory();
|
||||||
@ -101,7 +101,7 @@ public class SnapshotCommands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (MissingWorldException ex) {
|
} catch (MissingWorldException ex) {
|
||||||
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_FOUND_WORLD.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ public class SnapshotCommands {
|
|||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
if (config.snapshotRepo == null) {
|
if (config.snapshotRepo == null) {
|
||||||
BBC.SNAPSHOT_NOT_CONFIGURED.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_CONFIGURED.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,19 +128,19 @@ public class SnapshotCommands {
|
|||||||
|
|
||||||
if (snapshot != null) {
|
if (snapshot != null) {
|
||||||
session.setSnapshot(null);
|
session.setSnapshot(null);
|
||||||
BBC.SNAPSHOT_NEWEST.send(actor);
|
actor.print(BBC.SNAPSHOT_NEWEST.s());
|
||||||
} else {
|
} else {
|
||||||
BBC.SNAPSHOT_NOT_FOUND.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_FOUND.s());
|
||||||
}
|
}
|
||||||
} catch (MissingWorldException ex) {
|
} catch (MissingWorldException ex) {
|
||||||
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_FOUND_WORLD.s());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
|
session.setSnapshot(config.snapshotRepo.getSnapshot(name));
|
||||||
BBC.SNAPSHOT_SET.send(actor, name);
|
BBC.SNAPSHOT_SET.send(actor, name);
|
||||||
} catch (InvalidSnapshotException e) {
|
} catch (InvalidSnapshotException e) {
|
||||||
BBC.SNAPSHOT_NOT_AVAILABLE.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_AVAILABLE.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -150,36 +150,36 @@ public class SnapshotCommands {
|
|||||||
desc = "Choose the snapshot based on the list id"
|
desc = "Choose the snapshot based on the list id"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.snapshots.restore")
|
@CommandPermissions("worldedit.snapshots.restore")
|
||||||
public void sel(Player player, LocalSession session,
|
public void sel(Actor actor, World world, LocalSession session,
|
||||||
@Arg(desc = "The list ID to select")
|
@Arg(desc = "The list ID to select")
|
||||||
int index) throws WorldEditException {
|
int index) throws WorldEditException {
|
||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
if (config.snapshotRepo == null) {
|
if (config.snapshotRepo == null) {
|
||||||
BBC.SNAPSHOT_NOT_CONFIGURED.send(player);
|
actor.printError(BBC.SNAPSHOT_NOT_CONFIGURED.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 1) {
|
if (index < 1) {
|
||||||
BBC.SNAPSHOT_INVALID_INDEX.send(player);
|
actor.printError(BBC.SNAPSHOT_INVALID_INDEX.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, player.getWorld().getName());
|
List<Snapshot> snapshots = config.snapshotRepo.getSnapshots(true, world.getName());
|
||||||
if (snapshots.size() < index) {
|
if (snapshots.size() < index) {
|
||||||
player.printError("Invalid index, must be between 1 and " + snapshots.size() + ".");
|
actor.printError("Invalid index, must be between 1 and " + snapshots.size() + ".");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Snapshot snapshot = snapshots.get(index - 1);
|
Snapshot snapshot = snapshots.get(index - 1);
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
BBC.SNAPSHOT_NOT_AVAILABLE.send(player);
|
actor.printError(BBC.SNAPSHOT_NOT_AVAILABLE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
session.setSnapshot(snapshot);
|
session.setSnapshot(snapshot);
|
||||||
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
|
BBC.SNAPSHOT_SET.send(actor, snapshot.getName());
|
||||||
} catch (MissingWorldException e) {
|
} catch (MissingWorldException e) {
|
||||||
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
|
actor.printError(BBC.SNAPSHOT_NOT_FOUND_WORLD.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,29 +188,29 @@ public class SnapshotCommands {
|
|||||||
desc = "Choose the nearest snapshot before a date"
|
desc = "Choose the nearest snapshot before a date"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.snapshots.restore")
|
@CommandPermissions("worldedit.snapshots.restore")
|
||||||
public void before(Player player, LocalSession session,
|
public void before(Actor actor, World world, LocalSession session,
|
||||||
@Arg(desc = "The soonest date that may be used")
|
@Arg(desc = "The soonest date that may be used")
|
||||||
ZonedDateTime date) throws WorldEditException {
|
ZonedDateTime date) throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
if (config.snapshotRepo == null) {
|
if (config.snapshotRepo == null) {
|
||||||
BBC.SNAPSHOT_NOT_CONFIGURED.send(player);
|
actor.printError(BBC.SNAPSHOT_NOT_CONFIGURED.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, player.getWorld().getName());
|
Snapshot snapshot = config.snapshotRepo.getSnapshotBefore(date, world.getName());
|
||||||
|
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
player.printError("Couldn't find a snapshot before "
|
actor.printError("Couldn't find a snapshot before "
|
||||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
||||||
} else {
|
} else {
|
||||||
session.setSnapshot(snapshot);
|
session.setSnapshot(snapshot);
|
||||||
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
|
BBC.SNAPSHOT_SET.send(actor, snapshot.getName());
|
||||||
}
|
}
|
||||||
} catch (MissingWorldException ex) {
|
} catch (MissingWorldException ex) {
|
||||||
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
|
actor.printError(BBC.SNAPSHOT_NOT_FOUND_WORLD.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,28 +219,28 @@ public class SnapshotCommands {
|
|||||||
desc = "Choose the nearest snapshot after a date"
|
desc = "Choose the nearest snapshot after a date"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.snapshots.restore")
|
@CommandPermissions("worldedit.snapshots.restore")
|
||||||
public void after(Player player, LocalSession session,
|
public void after(Actor actor, World world, LocalSession session,
|
||||||
@Arg(desc = "The soonest date that may be used")
|
@Arg(desc = "The soonest date that may be used")
|
||||||
ZonedDateTime date) throws WorldEditException {
|
ZonedDateTime date) throws WorldEditException {
|
||||||
|
|
||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
if (config.snapshotRepo == null) {
|
if (config.snapshotRepo == null) {
|
||||||
BBC.SNAPSHOT_NOT_CONFIGURED.send(player);
|
actor.printError(BBC.SNAPSHOT_NOT_CONFIGURED.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, player.getWorld().getName());
|
Snapshot snapshot = config.snapshotRepo.getSnapshotAfter(date, world.getName());
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
player.printError("Couldn't find a snapshot after "
|
actor.printError("Couldn't find a snapshot after "
|
||||||
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
+ dateFormat.withZone(session.getTimeZone()).format(date) + ".");
|
||||||
} else {
|
} else {
|
||||||
session.setSnapshot(snapshot);
|
session.setSnapshot(snapshot);
|
||||||
BBC.SNAPSHOT_SET.send(player, snapshot.getName());
|
actor.print("Snapshot set to: " + snapshot.getName());
|
||||||
}
|
}
|
||||||
} catch (MissingWorldException ex) {
|
} catch (MissingWorldException ex) {
|
||||||
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(player);
|
actor.printError(BBC.SNAPSHOT_NOT_FOUND_WORLD.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class SnapshotUtilCommands {
|
|||||||
LocalConfiguration config = we.getConfiguration();
|
LocalConfiguration config = we.getConfiguration();
|
||||||
|
|
||||||
if (config.snapshotRepo == null) {
|
if (config.snapshotRepo == null) {
|
||||||
BBC.SNAPSHOT_NOT_CONFIGURED.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_CONFIGURED.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ public class SnapshotUtilCommands {
|
|||||||
try {
|
try {
|
||||||
snapshot = config.snapshotRepo.getSnapshot(snapshotName);
|
snapshot = config.snapshotRepo.getSnapshot(snapshotName);
|
||||||
} catch (InvalidSnapshotException e) {
|
} catch (InvalidSnapshotException e) {
|
||||||
BBC.SNAPSHOT_NOT_AVAILABLE.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_AVAILABLE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -92,7 +92,7 @@ public class SnapshotUtilCommands {
|
|||||||
snapshot = config.snapshotRepo.getDefaultSnapshot(world.getName());
|
snapshot = config.snapshotRepo.getDefaultSnapshot(world.getName());
|
||||||
|
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
BBC.SNAPSHOT_NOT_AVAILABLE.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_AVAILABLE.s());
|
||||||
|
|
||||||
// Okay, let's toss some debugging information!
|
// Okay, let's toss some debugging information!
|
||||||
File dir = config.snapshotRepo.getDirectory();
|
File dir = config.snapshotRepo.getDirectory();
|
||||||
@ -109,7 +109,7 @@ public class SnapshotUtilCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (MissingWorldException ex) {
|
} catch (MissingWorldException ex) {
|
||||||
BBC.SNAPSHOT_NOT_FOUND_WORLD.send(actor);
|
actor.printError(BBC.SNAPSHOT_NOT_FOUND_WORLD.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,15 +128,16 @@ public class SnapshotUtilCommands {
|
|||||||
if (restore.hadTotalFailure()) {
|
if (restore.hadTotalFailure()) {
|
||||||
String error = restore.getLastErrorMessage();
|
String error = restore.getLastErrorMessage();
|
||||||
if (!restore.getMissingChunks().isEmpty()) {
|
if (!restore.getMissingChunks().isEmpty()) {
|
||||||
BBC.SNAPSHOT_ERROR_RESTORE.send(actor);
|
actor.printError(BBC.SNAPSHOT_ERROR_RESTORE.s());
|
||||||
} else if (error != null) {
|
} else if (error != null) {
|
||||||
actor.printError("Errors prevented any blocks from being restored.");
|
actor.printError("Errors prevented any blocks from being restored.");
|
||||||
actor.printError("Last error: " + error);
|
actor.printError("Last error: " + error);
|
||||||
} else {
|
} else {
|
||||||
BBC.SNAPSHOT_ERROR_RESTORE_CHUNKS.send(actor);
|
actor.printError(BBC.SNAPSHOT_ERROR_RESTORE_CHUNKS.s());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
actor.print(String.format("Restored; %d missing chunks and %d other errors.",
|
actor.print(String.format("Restored; %d "
|
||||||
|
+ "missing chunks and %d other errors.",
|
||||||
restore.getMissingChunks().size(),
|
restore.getMissingChunks().size(),
|
||||||
restore.getErrorChunks().size()));
|
restore.getErrorChunks().size()));
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class SuperPickaxeCommands {
|
|||||||
public void single(Player player, LocalSession session) throws WorldEditException {
|
public void single(Player player, LocalSession session) throws WorldEditException {
|
||||||
session.setSuperPickaxe(new SinglePickaxe());
|
session.setSuperPickaxe(new SinglePickaxe());
|
||||||
session.enableSuperPickAxe();
|
session.enableSuperPickAxe();
|
||||||
BBC.SUPERPICKAXE_AREA_ENABLED.send(player);
|
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -71,7 +71,7 @@ public class SuperPickaxeCommands {
|
|||||||
|
|
||||||
session.setSuperPickaxe(new AreaPickaxe(range));
|
session.setSuperPickaxe(new AreaPickaxe(range));
|
||||||
session.enableSuperPickAxe();
|
session.enableSuperPickAxe();
|
||||||
BBC.SUPERPICKAXE_AREA_ENABLED.send(player);
|
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -93,6 +93,6 @@ public class SuperPickaxeCommands {
|
|||||||
|
|
||||||
session.setSuperPickaxe(new RecursivePickaxe(range));
|
session.setSuperPickaxe(new RecursivePickaxe(range));
|
||||||
session.enableSuperPickAxe();
|
session.enableSuperPickAxe();
|
||||||
BBC.SUPERPICKAXE_AREA_ENABLED.send(player);
|
player.print(BBC.SUPERPICKAXE_AREA_ENABLED.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class ToolUtilCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (maskOpt == null) {
|
if (maskOpt == null) {
|
||||||
BBC.BRUSH_MASK_DISABLED.send(player);
|
player.print(BBC.BRUSH_MASK_DISABLED.s());
|
||||||
tool.setMask(null);
|
tool.setMask(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ public class ToolUtilCommands {
|
|||||||
settings.addSetting(BrushSettings.SettingType.MASK, lastArg);
|
settings.addSetting(BrushSettings.SettingType.MASK, lastArg);
|
||||||
settings.setMask(maskOpt);
|
settings.setMask(maskOpt);
|
||||||
tool.update();
|
tool.update();
|
||||||
BBC.BRUSH_MASK.send(player);
|
player.print(BBC.BRUSH_MASK.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -101,7 +101,8 @@ public class ToolUtilCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.options.material")
|
@CommandPermissions("worldedit.brush.options.material")
|
||||||
public void material(Player player, LocalSession session,
|
public void material(Player player, LocalSession session,
|
||||||
@Arg(desc = "brush material pattern", def = "") Pattern patternOpt,
|
@Arg(desc = "The pattern of blocks to use")
|
||||||
|
Pattern pattern,
|
||||||
@Switch(name = 'h', desc = "TODO")
|
@Switch(name = 'h', desc = "TODO")
|
||||||
boolean offHand,
|
boolean offHand,
|
||||||
Arguments arguments) throws WorldEditException {
|
Arguments arguments) throws WorldEditException {
|
||||||
@ -110,17 +111,17 @@ public class ToolUtilCommands {
|
|||||||
player.print(BBC.BRUSH_NONE.s());
|
player.print(BBC.BRUSH_NONE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (patternOpt == null) {
|
if (pattern == null) {
|
||||||
BBC.BRUSH_MATERIAL.send(player);
|
player.print(BBC.BRUSH_MATERIAL.s());
|
||||||
tool.setFill(null);
|
tool.setFill(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||||
settings.setFill(patternOpt);
|
settings.setFill(pattern);
|
||||||
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
String lastArg = Iterables.getLast(CommandArgParser.spaceSplit(arguments.get())).getSubstring();
|
||||||
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
settings.addSetting(BrushSettings.SettingType.FILL, lastArg);
|
||||||
tool.update();
|
tool.update();
|
||||||
BBC.BRUSH_MATERIAL.send(player);
|
player.print(BBC.BRUSH_MATERIAL.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -129,7 +130,7 @@ public class ToolUtilCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.options.range")
|
@CommandPermissions("worldedit.brush.options.range")
|
||||||
public void range(Player player, LocalSession session,
|
public void range(Player player, LocalSession session,
|
||||||
@Arg(desc = "Range")
|
@Arg(desc = "The range of the brush")
|
||||||
int range) throws WorldEditException {
|
int range) throws WorldEditException {
|
||||||
range = Math.max(0, Math.min(256, range));
|
range = Math.max(0, Math.min(256, range));
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
@ -138,7 +139,7 @@ public class ToolUtilCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tool.setRange(range);
|
tool.setRange(range);
|
||||||
BBC.BRUSH_RANGE.send(player);
|
player.print(BBC.BRUSH_RANGE.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -148,19 +149,19 @@ public class ToolUtilCommands {
|
|||||||
@CommandPermissions("worldedit.brush.options.size")
|
@CommandPermissions("worldedit.brush.options.size")
|
||||||
public void size(Player player, LocalSession session,
|
public void size(Player player, LocalSession session,
|
||||||
@Arg(desc = "The size of the brush", def = "5")
|
@Arg(desc = "The size of the brush", def = "5")
|
||||||
int radius,
|
int size,
|
||||||
@Switch(name = 'h', desc = "TODO")
|
@Switch(name = 'h', desc = "TODO")
|
||||||
boolean offHand) throws WorldEditException {
|
boolean offHand) throws WorldEditException {
|
||||||
we.checkMaxBrushRadius(radius);
|
we.checkMaxBrushRadius(size);
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
player.print(BBC.BRUSH_NONE.s());
|
player.print(BBC.BRUSH_NONE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
BrushSettings settings = offHand ? tool.getOffHand() : tool.getContext();
|
||||||
settings.setSize(radius);
|
settings.setSize(size);
|
||||||
tool.update();
|
tool.update();
|
||||||
BBC.BRUSH_SIZE.send(player);
|
player.print(BBC.BRUSH_SIZE.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -174,13 +175,14 @@ public class ToolUtilCommands {
|
|||||||
Mask maskOpt) throws WorldEditException {
|
Mask maskOpt) throws WorldEditException {
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
player.print(BBC.BRUSH_NONE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tool.setTraceMask(maskOpt);
|
tool.setTraceMask(maskOpt);
|
||||||
BBC.BRUSH_TARGET_MASK_SET.send(player, maskOpt.toString());
|
BBC.BRUSH_TARGET_MASK_SET.send(player, maskOpt.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo none should be moved to the same class where it is in upstream
|
||||||
@Command(
|
@Command(
|
||||||
name = "none",
|
name = "none",
|
||||||
aliases = {"/none"},
|
aliases = {"/none"},
|
||||||
@ -269,11 +271,13 @@ public class ToolUtilCommands {
|
|||||||
"2 = Glass showing what blocks will be changed"
|
"2 = Glass showing what blocks will be changed"
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.brush.visualize")
|
@CommandPermissions("worldedit.brush.visualize")
|
||||||
public void visual(Player player, LocalSession session, @Arg(name = "mode", desc = "int", def = "0") @Range(min = 0, max = 2) int mode)
|
public void visual(Player player, LocalSession session,
|
||||||
|
@Arg(name = "mode", desc = "int", def = "0") @Range(min = 0, max = 2)
|
||||||
|
int mode)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
player.print(BBC.BRUSH_NONE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VisualMode[] modes = VisualMode.values();
|
VisualMode[] modes = VisualMode.values();
|
||||||
@ -292,7 +296,7 @@ public class ToolUtilCommands {
|
|||||||
@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);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
player.print(BBC.BRUSH_NONE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TargetMode[] modes = TargetMode.values();
|
TargetMode[] modes = TargetMode.values();
|
||||||
@ -311,7 +315,7 @@ public class ToolUtilCommands {
|
|||||||
int offset) throws WorldEditException {
|
int offset) throws WorldEditException {
|
||||||
BrushTool tool = session.getBrushTool(player, false);
|
BrushTool tool = session.getBrushTool(player, false);
|
||||||
if (tool == null) {
|
if (tool == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
player.print(BBC.BRUSH_NONE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tool.setTargetOffset(offset);
|
tool.setTargetOffset(offset);
|
||||||
@ -333,7 +337,7 @@ public class ToolUtilCommands {
|
|||||||
// TODO NOT IMPLEMENTED Convert ScrollAction to an argument converter
|
// TODO NOT IMPLEMENTED Convert ScrollAction to an argument converter
|
||||||
BrushTool bt = session.getBrushTool(player, false);
|
BrushTool bt = session.getBrushTool(player, false);
|
||||||
if (bt == null) {
|
if (bt == null) {
|
||||||
BBC.BRUSH_NONE.send(player);
|
player.print(BBC.BRUSH_NONE.s());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
BrushSettings settings = offHand ? bt.getOffHand() : bt.getContext();
|
||||||
@ -369,7 +373,7 @@ public class ToolUtilCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (maskArg == null) {
|
if (maskArg == null) {
|
||||||
BBC.BRUSH_SOURCE_MASK_DISABLED.send(player);
|
player.print(BBC.BRUSH_SOURCE_MASK_DISABLED.s());
|
||||||
tool.setSourceMask(null);
|
tool.setSourceMask(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -378,7 +382,7 @@ public class ToolUtilCommands {
|
|||||||
settings.addSetting(BrushSettings.SettingType.SOURCE_MASK, lastArg);
|
settings.addSetting(BrushSettings.SettingType.SOURCE_MASK, lastArg);
|
||||||
settings.setSourceMask(maskArg);
|
settings.setSourceMask(maskArg);
|
||||||
tool.update();
|
tool.update();
|
||||||
BBC.BRUSH_SOURCE_MASK.send(player);
|
player.print(BBC.BRUSH_SOURCE_MASK.s());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(
|
@Command(
|
||||||
@ -397,7 +401,7 @@ public class ToolUtilCommands {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (transform == null) {
|
if (transform == null) {
|
||||||
BBC.BRUSH_TRANSFORM_DISABLED.send(player);
|
player.print(BBC.BRUSH_TRANSFORM_DISABLED.s());
|
||||||
tool.setTransform(null);
|
tool.setTransform(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -406,6 +410,6 @@ public class ToolUtilCommands {
|
|||||||
settings.addSetting(BrushSettings.SettingType.TRANSFORM, lastArg);
|
settings.addSetting(BrushSettings.SettingType.TRANSFORM, lastArg);
|
||||||
settings.setTransform(transform);
|
settings.setTransform(transform);
|
||||||
tool.update();
|
tool.update();
|
||||||
BBC.BRUSH_TRANSFORM.send(player);
|
player.print(BBC.BRUSH_TRANSFORM.s());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.sk89q.worldedit.entity;
|
package com.sk89q.worldedit.entity;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public interface Metadatable {
|
public interface Metadatable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,36 +16,43 @@ public interface Metadatable {
|
|||||||
|
|
||||||
<T> T getAndSetMeta(String key, T value);
|
<T> T getAndSetMeta(String key, T value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the object contains any metadata.
|
||||||
|
*
|
||||||
|
* @return {@code true} if there is metadata set for the object
|
||||||
|
*/
|
||||||
boolean hasMeta();
|
boolean hasMeta();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the metadata for a key.
|
* Gets the metadata value to which the specified key is mapped,
|
||||||
|
* or {@code null} if the key is not set.
|
||||||
*
|
*
|
||||||
* @param <V>
|
* @param key the key of the metadata value to retrieve
|
||||||
* @param key
|
* @return the value of the metadata or {@code null} if none exists
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
<V> V getMeta(String key);
|
<V> V getMeta(String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the metadata for a specific key (or return the default provided)
|
* Gets the metadata value to which the specified key is mapped,
|
||||||
|
* or the default value if no metadata exists for the key.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key the key of the metadata value to retrieve
|
||||||
* @param def
|
* @param defaultValue the value to return if there is no metadata for the given key
|
||||||
* @param <V>
|
* @return the metadata value for the key, if present; else the default value
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
default <V> V getMeta(String key, V def) {
|
@NotNull
|
||||||
|
default <V> V getMeta(String key, @NotNull V defaultValue) {
|
||||||
V value = (V) getMeta(key);
|
V value = (V) getMeta(key);
|
||||||
return value == null ? def : value; }
|
return value == null ? defaultValue : value; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the metadata for a key.
|
* Deletes the given metadata key from object. Do not delete metadata set by another plugin
|
||||||
* - metadata is session only
|
* unless you know what you are doing.
|
||||||
* - deleting other plugin's metadata may cause issues
|
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key the key identifying the metadata to remove.
|
||||||
|
* @return the previous value associated with they given key
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
<V> V deleteMeta(String key);
|
<V> V deleteMeta(String key);
|
||||||
|
|
||||||
final class METADATA_KEYS {
|
final class METADATA_KEYS {
|
||||||
|
@ -19,11 +19,10 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent;
|
package com.sk89q.worldedit.extent;
|
||||||
|
|
||||||
import com.boydti.fawe.beta.IBatchProcessor;
|
|
||||||
import com.boydti.fawe.object.HistoryExtent;
|
|
||||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
|
|
||||||
|
import com.boydti.fawe.beta.IBatchProcessor;
|
||||||
|
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||||
import com.boydti.fawe.object.clipboard.WorldCopyClipboard;
|
import com.boydti.fawe.object.clipboard.WorldCopyClipboard;
|
||||||
import com.boydti.fawe.object.exception.FaweException;
|
import com.boydti.fawe.object.exception.FaweException;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
@ -142,9 +141,10 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
/**
|
/**
|
||||||
* Create an entity at the given location.
|
* Create an entity at the given location.
|
||||||
*
|
*
|
||||||
* @param entity the entity
|
* @param x the x coordinate
|
||||||
* @param location the location
|
* @param y the y coordinate
|
||||||
* @return a reference to the created entity, or null if the entity could not be created
|
* @param z the z coordinate
|
||||||
|
* @param uuid the unique identifier of the entity
|
||||||
*/
|
*/
|
||||||
default @Nullable void removeEntity(int x, int y, int z, UUID uuid) {}
|
default @Nullable void removeEntity(int x, int y, int z, UUID uuid) {}
|
||||||
|
|
||||||
|
@ -104,18 +104,18 @@ public interface ClipboardFormat {
|
|||||||
Set<String> getFileExtensions();
|
Set<String> getFileExtensions();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the player's clipboard
|
* Set the actor's clipboard
|
||||||
* @param player
|
* @param actor
|
||||||
* @param uri
|
* @param uri
|
||||||
* @param in
|
* @param inputStream the input stream
|
||||||
* @throws IOException
|
* @throws IOException thrown on I/O error
|
||||||
*/
|
*/
|
||||||
default URIClipboardHolder hold(Actor actor, URI uri, InputStream in) throws IOException {
|
default URIClipboardHolder hold(Actor actor, URI uri, InputStream inputStream) throws IOException {
|
||||||
checkNotNull(actor);
|
checkNotNull(actor);
|
||||||
checkNotNull(uri);
|
checkNotNull(uri);
|
||||||
checkNotNull(in);
|
checkNotNull(inputStream);
|
||||||
|
|
||||||
final ClipboardReader reader = getReader(in);
|
final ClipboardReader reader = getReader(inputStream);
|
||||||
|
|
||||||
final Clipboard clipboard;
|
final Clipboard clipboard;
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren