本文整理汇总了Java中com.sk89q.worldedit.world.World类的典型用法代码示例。如果您正苦于以下问题:Java World类的具体用法?Java World怎么用?Java World使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
World类属于com.sk89q.worldedit.world包,在下文中一共展示了World类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
protected void execute(Event event) {
String name = (String) this.name.getSingle(event);
World world = (World) this.world.getSingle(event);
ItemStack block = (ItemStack) this.block.getSingle(event);
RegionManager regionManager = WGBukkit.getRegionManager((org.bukkit.World) world);
if (!regionManager.hasRegion(name)) {
Skript.error("Region \"" + name + "\" in world \"" + world.getName() + "\" does not exists.");
return;
}
Vector v1 = regionManager.getRegion(name).getMaximumPoint();
Vector v2 = regionManager.getRegion(name).getMinimumPoint();
Region region = new CuboidRegion(v1, v2);
BaseBlock b = new BaseBlock(block.getTypeId(), block.getData().getData());
EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1);
try {
es.setBlocks(region, b);
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: revertVisuals
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
public void revertVisuals(Player player, GPPlayerData playerData, UUID claimUniqueId) {
final LocalSession session = this.getLocalSession(player.getName());
if (session == null || !session.hasCUISupport()) {
return;
}
final World world = this.getWorld(player.getWorld());
final RegionSelector region = session.getRegionSelector(world);
final GPActor actor = this.getOrCreateActor(player);
region.clear();
session.dispatchCUISelection(actor);
if (claimUniqueId != null) {
actor.dispatchCUIEvent(new MultiSelectionClearEvent(claimUniqueId));
} else {
actor.dispatchCUIEvent(new MultiSelectionClearEvent());
}
}
示例3: actPrimary
import com.sk89q.worldedit.world.World; //导入依赖的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: ascendUpwards
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
@Override
public boolean ascendUpwards(int distance, boolean alwaysGlass) {
final Vector pos = getBlockIn();
final int x = pos.getBlockX();
final int initialY = Math.max(0, pos.getBlockY());
int y = Math.max(0, pos.getBlockY() + 1);
final int z = pos.getBlockZ();
final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
final World world = getPosition().getWorld();
while (y <= world.getMaxY() + 2) {
if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) {
break; // Hit something
} else if (y > maxY + 1) {
break;
} else if (y == maxY + 1) {
floatAt(x, y - 1, z, alwaysGlass);
return true;
}
++y;
}
return false;
}
示例5: getQueue
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
private FaweQueue getQueue(World world) {
switch (getVersion()) {
case v1_7_R4:
return new BukkitQueue17(world);
case v1_8_R3:
return new BukkitQueue18R3(world);
case v1_9_R2:
return new BukkitQueue_1_9_R1(world);
case v1_10_R1:
return new BukkitQueue_1_10(world);
case v1_11_R1:
return new BukkitQueue_1_11(world);
case v1_12_R1:
return new BukkitQueue_1_12(world);
default:
case NONE:
return new BukkitQueue_All(world);
}
}
示例6: getMask
import com.sk89q.worldedit.world.World; //导入依赖的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);
}
}
示例7: saveHistoryNegativeIndex
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
private void saveHistoryNegativeIndex(UUID uuid, World world) {
if (world == null || !Settings.IMP.HISTORY.USE_DISK) {
return;
}
File file = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + Fawe.imp().getWorldName(world) + File.separator + uuid + File.separator + "index");
if (getHistoryNegativeIndex() != 0) {
try {
if (!file.exists()) {
file.getParentFile().mkdirs();
file.createNewFile();
}
FaweOutputStream os = new FaweOutputStream(new FileOutputStream(file));
os.writeInt(getHistoryNegativeIndex());
os.close();
} catch (IOException e) {
e.printStackTrace();
}
} else if (file.exists()) {
file.delete();
}
}
示例8: createProxy
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
public PlayerProxy createProxy() {
Player player = getPlayer();
World world = getWorldForEditing();
PlatformManager platformManager = WorldEdit.getInstance().getPlatformManager();
Player permActor = platformManager.queryCapability(Capability.PERMISSIONS).matchPlayer(player);
if (permActor == null) {
permActor = player;
}
Player cuiActor = platformManager.queryCapability(Capability.WORLDEDIT_CUI).matchPlayer(player);
if (cuiActor == null) {
cuiActor = player;
}
PlayerProxy proxy = new PlayerProxy(player, permActor, cuiActor, world);
if (world instanceof HeightMapMCAGenerator) {
proxy.setOffset(Vector.ZERO.subtract(((HeightMapMCAGenerator) world).getOrigin()));
}
return proxy;
}
示例9: getResettableExtent
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
/**
* Gets an {@link com.sk89q.worldedit.extent.Extent} from a {@link ArgumentStack}.
*
* @param context the context
* @return an extent
* @throws ParameterException on other error
*/
@BindingMatch(type = ResettableExtent.class,
behavior = BindingBehavior.PROVIDES)
public ResettableExtent getResettableExtent(ArgumentStack context) throws ParameterException, InputParseException {
String input = context.next();
if (input.equalsIgnoreCase("#null")) return new NullExtent();
DefaultTransformParser parser = Fawe.get().getTransformParser();
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.getInstance().getSessionManager().get(actor));
return parser.parseFromInput(input, parserContext);
}
示例10: actPrimary
import com.sk89q.worldedit.world.World; //导入依赖的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;
}
示例11: getPattern
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
/**
* Gets an {@link Pattern} from a {@link ArgumentStack}.
*
* @param context the context
* @return a pattern
* @throws ParameterException on error
* @throws WorldEditException on error
*/
@BindingMatch(type = Pattern.class,
behavior = BindingBehavior.CONSUMES,
consumedCount = 1)
public Pattern getPattern(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.getPatternFactory().parseFromInput(context.next(), parserContext);
} catch (NoMatchException e) {
throw new ParameterException(e.getMessage(), e);
}
}
示例12: wrapForLogging
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
public void wrapForLogging(EditSessionEvent event)
{
event.setExtent(new AbstractLoggingExtent(event) {
final WESlimefunManager this$0;
private final EditSessionEvent val$event;
protected void onBlockChange(Vector pos, BaseBlock b)
{
super.onBlockChange(pos, b);
if(b.getType() == 0)
{
org.bukkit.World world = Bukkit.getWorld(event.getWorld().getName());
if(world != null)
{
Location l = new Location(world, pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
if(BlockStorage.hasBlockInfo(l))
BlockStorage.clearBlockInfo(l);
}
}
}
{
this$0 = WESlimefunManager.this;
event = editsessionevent;
super($anonymous0);
}
}
);
}
示例13: getWorld
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
public World getWorld(String playerName) {
final LocalSession session = getLocalSession(playerName);
if (session == null) {
return null;
}
return session.getSelectionWorld();
}
示例14: getRegionSelector
import com.sk89q.worldedit.world.World; //导入依赖的package包/类
public RegionSelector getRegionSelector(Player player) {
final LocalSession session = getLocalSession(player.getName());
if (session == null) {
return null;
}
World world = session.getSelectionWorld();
if (world == null) {
world = this.getWorld(player.getWorld());
}
return session.getRegionSelector(world);
}
示例15: recordHistory
import com.sk89q.worldedit.world.World; //导入依赖的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());
}
}