本文整理汇总了Java中com.sk89q.worldedit.WorldEditException类的典型用法代码示例。如果您正苦于以下问题:Java WorldEditException类的具体用法?Java WorldEditException怎么用?Java WorldEditException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorldEditException类属于com.sk89q.worldedit包,在下文中一共展示了WorldEditException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBlock
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Override
public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException
{
Player player = WorldGuardExtraFlagsPlugin.getPlugin().getServer().getPlayer(this.actor.getUniqueId());
if (WorldGuardUtils.hasBypass(player))
{
return super.setBlock(location, block);
}
else
{
if (WorldGuardExtraFlagsPlugin.getWorldGuardPlugin().getRegionContainer().createQuery().getApplicableRegions(BukkitUtil.toLocation(player.getWorld(), location)).queryValue(WorldGuardUtils.wrapPlayer(player), FlagUtils.WORLDEDIT) != State.DENY)
{
return super.setBlock(location, block);
}
else
{
return false;
}
}
}
示例2: getMask
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
/**
* Gets an {@link Mask} from a {@link ArgumentStack}.
*
* @param context the context
* @return a pattern
* @throws ParameterException on error
* @throws WorldEditException on error
*/
@BindingMatch(type = Mask.class,
behavior = BindingBehavior.CONSUMES,
consumedCount = 1)
public Mask getMask(ArgumentStack context) throws ParameterException, WorldEditException {
Actor actor = context.getContext().getLocals().get(Actor.class);
ParserContext parserContext = new ParserContext();
parserContext.setActor(context.getContext().getLocals().get(Actor.class));
if (actor instanceof Entity) {
Extent extent = ((Entity) actor).getExtent();
if (extent instanceof World) {
parserContext.setWorld((World) extent);
}
}
parserContext.setSession(worldEdit.getSessionManager().get(actor));
try {
return worldEdit.getMaskFactory().parseFromInput(context.next(), parserContext);
} catch (NoMatchException e) {
throw new ParameterException(e.getMessage(), e);
}
}
示例3: rotate
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"/rotate"},
usage = "<y-axis> [<x-axis>] [<z-axis>]",
desc = "Rotate the contents of the clipboard",
help = "Non-destructively rotate the contents of the clipboard.\n" +
"Angles are provided in degrees and a positive angle will result in a clockwise rotation. " +
"Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n"
)
@CommandPermissions("worldedit.clipboard.rotate")
public void rotate(Player player, LocalSession session, Double yRotate, @Optional Double xRotate, @Optional Double zRotate) throws WorldEditException {
ClipboardHolder holder = session.getClipboard();
AffineTransform transform = new AffineTransform();
transform = transform.rotateY(-(yRotate != null ? yRotate : 0));
transform = transform.rotateX(-(xRotate != null ? xRotate : 0));
transform = transform.rotateZ(-(zRotate != null ? zRotate : 0));
holder.setTransform(transform.combine(holder.getTransform()));
BBC.COMMAND_ROTATE.send(player);
if (!FawePlayer.wrap(player).hasPermission("fawe.tips"))
BBC.TIP_FLIP.or(BBC.TIP_DEFORM, BBC.TIP_TRANSFORM).send(player);
}
示例4: removeLayers
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"removelayers"},
usage = "<id>",
desc = "Removes matching chunk layers",
help = "Remove if all the selected layers in a chunk match the provided id"
)
@CommandPermissions("worldedit.anvil.removelayer")
public void removeLayers(Player player, EditSession editSession, @Selection Region selection, int id) throws WorldEditException {
Vector min = selection.getMinimumPoint();
Vector max = selection.getMaximumPoint();
int minY = min.getBlockY();
int maxY = max.getBlockY();
RemoveLayerFilter filter = new RemoveLayerFilter(minY, maxY, id);
MCAFilterCounter result = runWithSelection(player, editSession, selection, filter);
if (result != null) {
player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal()));
}
}
示例5: replaceAll
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"replaceall", "rea", "repall"},
usage = "<folder> [from-block] <to-block>",
desc = "Replace all blocks in the selection with another",
help = "Replace all blocks in the selection with another\n" +
"The -d flag disabled wildcard data matching\n",
flags = "df",
min = 2,
max = 4
)
@CommandPermissions("worldedit.anvil.replaceall")
public void replaceAll(Player player, String folder, @Optional String from, String to, @Switch('d') boolean useData) throws WorldEditException {
final FaweBlockMatcher matchFrom;
if (from == null) {
matchFrom = FaweBlockMatcher.NOT_AIR;
} else {
if (from.contains(":")) {
useData = true; //override d flag, if they specified data they want it
}
matchFrom = FaweBlockMatcher.fromBlocks(worldEdit.getBlocks(player, from, true), useData);
}
final FaweBlockMatcher matchTo = FaweBlockMatcher.setBlocks(worldEdit.getBlocks(player, to, true));
ReplaceSimpleFilter filter = new ReplaceSimpleFilter(matchFrom, matchTo);
ReplaceSimpleFilter result = runWithWorld(player, folder, filter, true);
if (result != null) player.print(BBC.getPrefix() + BBC.VISITOR_BLOCK.format(result.getTotal()));
}
示例6: splineBrush
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"spline", "spl", "curve"},
usage = "<pattern>",
desc = "Join multiple objects together in a curve",
help = "Click to select some objects,click the same block twice to connect the objects.\n" +
"Insufficient brush radius, or clicking the the wrong spot will result in undesired shapes. The shapes must be simple lines or loops.\n" +
"Pic1: http://i.imgur.com/CeRYAoV.jpg -> http://i.imgur.com/jtM0jA4.png\n" +
"Pic2: http://i.imgur.com/bUeyc72.png -> http://i.imgur.com/tg6MkcF.png",
min = 0,
max = 2
)
@CommandPermissions("worldedit.brush.spline")
public BrushSettings splineBrush(Player player, EditSession editSession, LocalSession session, Pattern fill, @Optional("25") double radius, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
player.print(BBC.getPrefix() + BBC.BRUSH_SPLINE.f(radius));
return get(context)
.setBrush(new SplineBrush(player, session))
.setSize(radius)
.setFill(fill);
}
示例7: green
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"/green", "green"},
usage = "[radius]",
desc = "Greens the area",
flags = "f",
min = 0,
max = 1
)
@CommandPermissions("worldedit.green")
@Logging(PLACEMENT)
public void green(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException {
final double size = args.argsLength() > 0 ? Math.max(1, args.getDouble(0)) : 10;
final boolean onlyNormalDirt = !args.hasFlag('f');
final int affected = editSession.green(session.getPlacementPosition(player), size, onlyNormalDirt);
player.print(BBC.getPrefix() + affected + " surfaces greened.");
}
示例8: runOperation
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
private static Operation runOperation(Operation operation, RunContext context) {
Operation next = operation;
while (next != null && context.shouldContinue()) {
try {
next = next.resume(context);
} catch (WorldEditException e) {
e.printStackTrace();
return null;
}
}
if (next != null) {
return next;
} else {
return null;
}
}
示例9: hpos1
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"/hpos1"},
usage = "",
desc = "Set position 1 to targeted block",
min = 0,
max = 0
)
@CommandPermissions("worldedit.selection.hpos")
public void hpos1(Player player, LocalSession session, CommandContext args) throws WorldEditException {
Vector pos = player.getBlockTrace(300);
if (pos != null) {
if (!session.getRegionSelector(player.getWorld()).selectPrimary(pos, ActorSelectorLimits.forActor(player))) {
BBC.SELECTOR_ALREADY_SET.send(player);
return;
}
session.getRegionSelector(player.getWorld())
.explainPrimarySelection(player, session, pos);
} else {
player.printError("No block in sight!");
}
}
示例10: hsphere
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"/hsphere"},
usage = "<pattern> <radius>[,<radius>,<radius>] [raised?]",
desc = "Generates a hollow sphere.",
help =
"Generates a hollow sphere.\n" +
"By specifying 3 radii, separated by commas,\n" +
"you can generate an ellipsoid. The order of the ellipsoid radii\n" +
"is north/south, up/down, east/west.",
min = 2,
max = 3
)
@CommandPermissions("worldedit.generation.sphere")
@Logging(PLACEMENT)
public void hsphere(FawePlayer fp, Player player, LocalSession session, EditSession editSession, Pattern pattern, Vector radius, @Optional("false") boolean raised, CommandContext context) throws WorldEditException, ParameterException {
sphere(fp, player, session, editSession, pattern, radius, raised, true, context);
}
示例11: hpos2
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"/hpos2"},
usage = "",
desc = "Set position 2 to targeted block",
min = 0,
max = 0
)
@CommandPermissions("worldedit.selection.hpos")
public void hpos2(Player player, LocalSession session, CommandContext args) throws WorldEditException {
Vector pos = player.getBlockTrace(300);
if (pos != null) {
if (!session.getRegionSelector(player.getWorld()).selectSecondary(pos, ActorSelectorLimits.forActor(player))) {
BBC.SELECTOR_ALREADY_SET.send(player);
return;
}
session.getRegionSelector(player.getWorld())
.explainSecondarySelection(player, session, pos);
} else {
player.printError("No block in sight!");
}
}
示例12: replace
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"/replace", "/re", "/rep", "/r"},
usage = "[from-mask] <to-pattern>",
desc = "Replace all blocks in the selection with another",
flags = "f",
min = 1,
max = 2
)
@CommandPermissions("worldedit.region.replace")
@Logging(REGION)
public void replace(FawePlayer player, EditSession editSession, @Selection Region region, @Optional Mask from, Pattern to, CommandContext context) throws WorldEditException {
player.checkConfirmationRegion(getArguments(context), region);
if (from == null) {
from = new ExistingBlockMask(editSession);
}
int affected = editSession.replaceBlocks(region, from, to);
BBC.VISITOR_BLOCK.send(player, affected);
if (!player.hasPermission("fawe.tips"))
BBC.TIP_REPLACE_ID.or(BBC.TIP_REPLACE_LIGHT, BBC.TIP_REPLACE_MARKER, BBC.TIP_TAB_COMPLETE).send(player);
}
示例13: setBlock
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Override
public boolean setBlock(final Vector location, final BaseBlock block) throws WorldEditException {
if (super.setBlock(location, block)) {
if (MemUtil.isMemoryLimited()) {
if (this.player != null) {
player.sendMessage(BBC.WORLDEDIT_CANCEL_REASON.format(BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY.s()));
if (Perm.hasPermission(this.player, "worldedit.fast")) {
BBC.WORLDEDIT_OOM_ADMIN.send(this.player);
}
}
WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY);
return false;
}
return true;
}
return false;
}
示例14: copy
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Command(
aliases = {"copypaste", "copy", "paste", "cp", "copypasta"},
usage = "[depth=5]",
desc = "Copy Paste brush",
help = "Left click the base of an object to copy.\n" +
"Right click to paste\n" +
"The -r flag Will apply random rotation on paste\n" +
"The -a flag Will apply auto view based rotation on paste\n" +
"Note: Works well with the clipboard scroll action\n" +
"Video: https://www.youtube.com/watch?v=RPZIaTbqoZw",
min = 0,
max = 1
)
@CommandPermissions("worldedit.brush.copy")
public BrushSettings copy(Player player, LocalSession session, @Optional("5") double radius, @Switch('r') boolean randomRotate, @Switch('a') boolean autoRotate, CommandContext context) throws WorldEditException {
worldEdit.checkMaxBrushRadius(radius);
player.print(BBC.getPrefix() + BBC.BRUSH_COPY.f(radius));
return get(context)
.setBrush(new CopyPastaBrush(player, session, randomRotate, autoRotate))
.setSize(radius);
}
示例15: setBlock
import com.sk89q.worldedit.WorldEditException; //导入依赖的package包/类
@Override
public boolean setBlock(int x, int y, int z, BaseBlock block) throws WorldEditException {
CompoundTag nbt = block.getNbtData();
if (nbt != null) {
if (!limit.MAX_BLOCKSTATES()) {
WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_TILES);
return false;
} else {
if (!limit.MAX_CHANGES()) {
WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
return false;
}
return extent.setBlock(x, y, z, block);
}
}
if (!limit.MAX_CHANGES()) {
WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
return false;
} else {
return extent.setBlock(x, y, z, block);
}
}