本文整理汇总了Java中com.sk89q.worldedit.LocalSession.remember方法的典型用法代码示例。如果您正苦于以下问题:Java LocalSession.remember方法的具体用法?Java LocalSession.remember怎么用?Java LocalSession.remember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.LocalSession
的用法示例。
在下文中一共展示了LocalSession.remember方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: floatAt
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Override
public void floatAt(final int x, final int y, final int z, final boolean alwaysGlass) {
RuntimeException caught = null;
try {
EditSession edit = new EditSessionBuilder(parent.getWorld()).player(FawePlayer.wrap(this)).build();
edit.setBlockFast(new Vector(x, y - 1, z), new BaseBlock(BlockType.GLASS.getID()));
edit.flushQueue();
LocalSession session = Fawe.get().getWorldEdit().getSession(this);
if (session != null) {
session.remember(edit, true, FawePlayer.wrap(this).getLimit().MAX_HISTORY);
}
} catch (RuntimeException e) {
caught = e;
}
TaskManager.IMP.sync(new RunnableVal<Object>() {
@Override
public void run(Object value) {
setPosition(new Vector(x + 0.5, y, z + 0.5));
}
});
if (caught != null) {
throw caught;
}
}
示例2: cfi
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Command(
aliases = {"cfi", "createfromimage"},
usage = "",
min = 0,
max = -1,
anyFlags = true,
desc = "Start CreateFromImage"
)
@CommandPermissions("worldedit.anvil.cfi")
public void cfi(FawePlayer fp, CommandContext context) throws CommandException, IOException {
CFICommands.CFISettings settings = child.getSettings(fp);
settings.popMessages(fp);
dispatch(fp, settings, context);
HeightMapMCAGenerator gen = settings.getGenerator();
if (gen != null && gen.isModified()) {
gen.update();
CFIChangeSet set = new CFIChangeSet(gen, fp.getUUID());
LocalSession session = fp.getSession();
session.remember(fp.getPlayer(), gen, set, fp.getLimit());
}
}
示例3: actPrimary
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent();
final int blockType = world.getBlockType(clicked.toVector());
if (blockType == BlockID.BEDROCK
&& !player.canDestroyBedrock()) {
return true;
}
EditSession editSession = session.createEditSession(player);
editSession.getSurvivalExtent().setToolUse(config.superPickaxeDrop);
try {
if (editSession.setBlock(clicked.getBlockX(), clicked.getBlockY(), clicked.getBlockZ(), EditSession.nullBlock)) {
world.playEffect(clicked.toVector(), 2001, blockType);
}
} finally {
editSession.flushQueue();
session.remember(editSession);
}
return true;
}
示例4: actPrimary
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {
World world = (World) clicked.getExtent();
int initialType = world.getBlockType(clicked.toVector());
if (initialType == BlockID.AIR) {
return true;
}
if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) {
return true;
}
EditSession editSession = session.createEditSession(player);
try {
recurse(server, editSession, world, clicked.toVector().toBlockVector(),
clicked.toVector(), range, initialType, new HashSet<BlockVector>());
} catch (WorldEditException e) {
throw new RuntimeException(e);
}
editSession.flushQueue();
session.remember(editSession);
return true;
}
示例5: recordHistory
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
public static void recordHistory(FawePlayer fp, World world, Consumer<IAnvilHistory> run) {
LocalSession session = fp.getSession();
if (session == null || session.hasFastMode()) {
run.accept(new NullAnvilHistory());
} else {
AnvilHistory history = new AnvilHistory(Fawe.imp().getWorldName(world), fp.getUUID());
run.accept(history);
session.remember(fp.getPlayer(), world, history, fp.getLimit());
}
}
示例6: actPrimary
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
World world = (World) clicked.getExtent();
final Vector pos = clicked.toVector();
EditSession editSession = session.createEditSession(player);
BaseBlock block = editSession.getBlock(pos);
int initialType = block.getType();
if (initialType == BlockID.AIR || (initialType == BlockID.BEDROCK && !player.canDestroyBedrock())) {
editSession.flushQueue();
return true;
}
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
final int radius = (int) range;
final BlockReplace replace = new BlockReplace(editSession, (editSession.nullBlock));
editSession.setMask((Mask) null);
RecursiveVisitor visitor = new RecursiveVisitor(new IdMask(editSession), replace, radius, editSession);
visitor.visit(pos);
Operations.completeBlindly(visitor);
editSession.flushQueue();
session.remember(editSession);
return true;
}
示例7: actPrimary
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
@Override
public boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, com.sk89q.worldedit.util.Location clicked) {
int ox = clicked.getBlockX();
int oy = clicked.getBlockY();
int oz = clicked.getBlockZ();
int initialType = ((World) clicked.getExtent()).getBlockType(clicked.toVector());
if (initialType == 0) {
return true;
}
if (initialType == BlockID.BEDROCK && !player.canDestroyBedrock()) {
return true;
}
EditSession editSession = session.createEditSession(player);
editSession.getSurvivalExtent().setToolUse(config.superPickaxeManyDrop);
for (int x = ox - range; x <= ox + range; ++x) {
for (int y = oy - range; y <= oy + range; ++y) {
for (int z = oz - range; z <= oz + range; ++z) {
if (editSession.getLazyBlock(x, y, z).getId() != initialType) {
continue;
}
editSession.setBlock(x, y, z, air);
}
}
}
editSession.flushQueue();
session.remember(editSession);
return true;
}
示例8: act
import com.sk89q.worldedit.LocalSession; //导入方法依赖的package包/类
public boolean act(BrushAction action, Platform server, LocalConfiguration config, Player player, LocalSession session) {
switch (action) {
case PRIMARY:
setContext(primary);
break;
case SECONDARY:
setContext(secondary);
break;
}
BrushSettings current = getContext();
Brush brush = current.getBrush();
if (brush == null) return false;
EditSession editSession = session.createEditSession(player);
Vector target = getPosition(editSession, player);
if (target == null) {
editSession.cancel();
BBC.NO_BLOCK.send(player);
return true;
}
BlockBag bag = session.getBlockBag(player);
Request.request().setEditSession(editSession);
Mask mask = current.getMask();
if (mask != null) {
Mask existingMask = editSession.getMask();
if (existingMask == null) {
editSession.setMask(mask);
} else if (existingMask instanceof MaskIntersection) {
((MaskIntersection) existingMask).add(mask);
} else {
MaskIntersection newMask = new MaskIntersection(existingMask);
newMask.add(mask);
editSession.setMask(newMask);
}
}
Mask sourceMask = current.getSourceMask();
if (sourceMask != null) {
editSession.addSourceMask(sourceMask);
}
ResettableExtent transform = current.getTransform();
if (transform != null) {
editSession.addTransform(transform);
}
try {
new PatternTraverser(current).reset(editSession);
brush.build(editSession, target, current.getMaterial(), current.getSize());
} catch (MaxChangedBlocksException e) {
player.printError("Max blocks change limit reached."); // Never happens
} finally {
if (bag != null) {
bag.flushChanges();
}
session.remember(editSession);
Request.reset();
}
return true;
}