本文整理汇总了Java中com.sk89q.worldedit.regions.RegionOperationException类的典型用法代码示例。如果您正苦于以下问题:Java RegionOperationException类的具体用法?Java RegionOperationException怎么用?Java RegionOperationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RegionOperationException类属于com.sk89q.worldedit.regions包,在下文中一共展示了RegionOperationException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shift
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Override
public void shift(Vector change) throws RegionOperationException {
shiftCollection(vertices, change);
shiftCollection(vertexBacklog, change);
for (int i = 0; i < triangles.size(); ++i) {
final Triangle triangle = triangles.get(i);
final Vector v0 = change.add(triangle.getVertex(0));
final Vector v1 = change.add(triangle.getVertex(1));
final Vector v2 = change.add(triangle.getVertex(2));
triangles.set(i, new Triangle(v0, v1, v2));
}
minimumPoint = change.add(minimumPoint);
maximumPoint = change.add(maximumPoint);
centerAccum = change.multiply(vertices.size()).add(centerAccum);
lastTriangle = null;
}
示例2: run
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Override
public void run() {
World world = parent.getPlugin().world;
Helper.fillVolume(world, parent.toGlobal(targetRegion.getPos1()),
parent.toGlobal(targetRegion.getPos2()), blockMaterial);
try {
targetRegion.shift(incrementVec);
} catch (RegionOperationException e) {
parent.getPlugin().getLogger().info("Shifting target region for room task failded!");
e.printStackTrace();
}
}
示例3: checkConfirmationRadius
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
public void checkConfirmationRadius(String command, int radius) throws RegionOperationException {
if (command == null || getMeta("cmdConfirmRunning", false)) {
return;
}
if (radius > 0) {
if (radius > 448) {
setMeta("cmdConfirm", command);
throw new RegionOperationException(BBC.WORLDEDIT_CANCEL_REASON_CONFIRM.f(0, radius, command));
}
}
}
示例4: checkConfirmationStack
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
public void checkConfirmationStack(String command, Region region, int times) throws RegionOperationException {
if (command == null || getMeta("cmdConfirmRunning", false)) {
return;
}
if (region != null) {
Vector min = region.getMinimumPoint();
Vector max = region.getMaximumPoint();
long area = (long) ((max.getX() - min.getX()) * (max.getZ() - min.getZ() + 1)) * times;
if (area > 2 << 18) {
setMeta("cmdConfirm", command);
throw new RegionOperationException(BBC.WORLDEDIT_CANCEL_REASON_CONFIRM.f(min, max, command));
}
}
}
示例5: checkConfirmationRegion
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
public void checkConfirmationRegion(String command, Region region) throws RegionOperationException {
if (command == null || getMeta("cmdConfirmRunning", false)) {
return;
}
if (region != null) {
Vector min = region.getMinimumPoint();
Vector max = region.getMaximumPoint();
long area = (long) ((max.getX() - min.getX()) * (max.getZ() - min.getZ() + 1));
if (area > 2 << 18) {
setMeta("cmdConfirm", command);
throw new RegionOperationException(BBC.WORLDEDIT_CANCEL_REASON_CONFIRM.f(min, max, command));
}
}
}
示例6: shift
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Command(
aliases = {"/shift"},
usage = "<amount> [direction]",
desc = "Shift the selection area",
min = 1,
max = 2
)
@Logging(REGION)
@CommandPermissions("worldedit.selection.shift")
public void shift(Player player, LocalSession session, CommandContext args) throws WorldEditException {
List<Vector> dirs = new ArrayList<Vector>();
int change = args.getInteger(0);
if (args.argsLength() == 2) {
if (args.getString(1).contains(",")) {
for (String s : args.getString(1).split(",")) {
dirs.add(we.getDirection(player, s.toLowerCase()));
}
} else {
dirs.add(we.getDirection(player, args.getString(1).toLowerCase()));
}
} else {
dirs.add(we.getDirection(player, "me"));
}
try {
Region region = session.getSelection(player.getWorld());
for (Vector dir : dirs) {
region.shift(dir.multiply(change));
}
session.getRegionSelector(player.getWorld()).learnChanges();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player, session);
BBC.SELECTION_SHIFT.send(player);
} catch (RegionOperationException e) {
player.printError(e.getMessage());
}
}
示例7: getOriginFromRegion
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
public Vector getOriginFromRegion(Region region) throws RegionOperationException {
Vector origin;
if(region instanceof CuboidRegion || region instanceof Polygonal2DRegion)
origin = region.getMinimumPoint();
else throw new RegionOperationException("Region is neither Cuboid or Polygonal");
return origin;
}
示例8: set
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
public final void set(int x, int y, int z) throws RegionOperationException {
set.add(x, y, z);
setMinMax(x, y, z);
}
示例9: expand
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Override
public void expand(Vector... changes) throws RegionOperationException {
throw new RegionOperationException("Selection cannot expand");
}
示例10: contract
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Override
public void contract(Vector... changes) throws RegionOperationException {
throw new RegionOperationException("Selection cannot contract");
}
示例11: shift
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Override
public void shift(Vector change) throws RegionOperationException {
throw new RegionOperationException("Selection cannot be shifted");
}
示例12: expand
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Override
public void expand(Vector... changes) throws RegionOperationException {
}
示例13: contract
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Override
public void contract(Vector... changes) throws RegionOperationException {
}
示例14: move
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Command(
aliases = {"/move"},
usage = "[count] [direction] [leave-id]",
flags = "s",
desc = "Move the contents of the selection",
help =
"Moves the contents of the selection.\n" +
" -s flag shifts the selection to the target location.\n" +
" -b also copies biomes\n" +
" -e ignores entities\n" +
" -a ignores air\n" +
"Optionally fills the old location with <leave-id>.",
min = 0,
max = 3
)
@CommandPermissions("worldedit.region.move")
@Logging(ORIENTATION_REGION)
public void move(FawePlayer player, LocalSession session, EditSession editSession,
@Selection Region region,
@Optional("1") @Range(min = 1) int count,
@Optional(Direction.AIM) @Direction Vector direction,
@Optional("air") Pattern replace,
@Switch('b') boolean copyBiomes,
@Switch('e') boolean skipEntities,
@Switch('a') boolean skipAir,
@Switch('s') boolean moveSelection,
CommandContext context) throws WorldEditException {
player.checkConfirmationRegion(getArguments(context), region);
int affected = editSession.moveRegion(region, direction, count, !skipAir, !skipEntities, copyBiomes, replace);
if (moveSelection) {
try {
region.shift(direction.multiply(count));
session.getRegionSelector(player.getWorld()).learnChanges();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player.getPlayer(), session);
} catch (RegionOperationException e) {
player.sendMessage(BBC.getPrefix() + e.getMessage());
}
}
BBC.VISITOR_BLOCK.send(player, affected);
}
示例15: stack
import com.sk89q.worldedit.regions.RegionOperationException; //导入依赖的package包/类
@Command(
aliases = {"/stack"},
usage = "[count] [direction]",
flags = "sam",
desc = "Repeat the contents of the selection",
help =
"Repeats the contents of the selection.\n" +
"Flags:\n" +
" -s shifts the selection to the last stacked copy\n" +
" -a skips air blocks",
min = 0,
max = 2
)
@CommandPermissions("worldedit.region.stack")
@Logging(ORIENTATION_REGION)
public void stack(FawePlayer player, LocalSession session, EditSession editSession,
@Selection Region region,
@Optional("1") @Range(min = 1) int count,
@Optional(Direction.AIM) @Direction Vector direction,
@Switch('s') boolean moveSelection,
@Switch('b') boolean copyBiomes,
@Switch('e') boolean skipEntities,
@Switch('a') boolean ignoreAirBlocks, @Switch('m') Mask sourceMask, CommandContext context) throws WorldEditException {
player.checkConfirmationStack(getArguments(context), region, count);
if (sourceMask != null) {
editSession.addSourceMask(sourceMask);
}
int affected = editSession.stackCuboidRegion(region, direction, count, !ignoreAirBlocks, !skipEntities, copyBiomes);
if (moveSelection) {
try {
final Vector size = region.getMaximumPoint().subtract(region.getMinimumPoint()).add(1, 1, 1);
Vector shiftVector = new Vector(direction.getX() * size.getX() * count, direction.getY() * size.getY() * count, direction.getZ() * size.getZ() * count);
region.shift(shiftVector);
session.getRegionSelector(player.getWorld()).learnChanges();
session.getRegionSelector(player.getWorld()).explainRegionAdjust(player.getPlayer(), session);
} catch (RegionOperationException e) {
player.sendMessage(BBC.getPrefix() + e.getMessage());
}
}
BBC.VISITOR_BLOCK.send(player, affected);
}