本文整理汇总了Java中com.sk89q.worldedit.bukkit.BukkitUtil.getLocalWorld方法的典型用法代码示例。如果您正苦于以下问题:Java BukkitUtil.getLocalWorld方法的具体用法?Java BukkitUtil.getLocalWorld怎么用?Java BukkitUtil.getLocalWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.bukkit.BukkitUtil
的用法示例。
在下文中一共展示了BukkitUtil.getLocalWorld方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
@Override
protected boolean execute() {
while (!regions.isEmpty()) {
final Region region = regions.remove(0);
LocalWorld localWorld = BukkitUtil.getLocalWorld(world);
final EditSession editSession = WorldEditHandler.createEditSession(localWorld, region.getArea() * 255);
editSession.enableQueue();
editSession.setFastMode(true);
try {
editSession.setBlocks(region, AIR);
} catch (MaxChangedBlocksException e) {
log.log(Level.INFO, "Warning: we got MaxChangedBlocks from WE, please increase it!");
}
editSession.flushQueue();
//editSession.commit();
if (!tick()) {
break;
}
}
return regions.isEmpty();
}
示例2: clearOldRegions
import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void clearOldRegions() {
for (String planetName : centreCoordinates.keySet()){
ProtectedRegion wgRegion = rgMgr.getRegion(planetName);
if(wgRegion == null){
print("No WG region forund for planet '"+planetName+"', skipping region deletion.");
continue;
}
com.sk89q.worldedit.LocalWorld weWorld = BukkitUtil.getLocalWorld(world);
EditSession es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
Region weRegion = new Polygonal2DRegion(weWorld,
wgRegion.getPoints(),
wgRegion.getMinimumPoint().getBlockY(),
wgRegion.getMaximumPoint().getBlockY());
try {
es.setBlocks(weRegion, new BaseBlock(BlockID.AIR));
} catch (MaxChangedBlocksException e) {
// should never happen as limit is -1
print("Error deleting blocks with WE for planet '"+planetName+"', max block limit reached.");
}
rgMgr.removeRegion(planetName);
}
}
示例3: loadRegion
import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
/**
* Load a given region from a file configuration
*
* @param file The file to save too
* @param path The path in the file config
* @return The loaded region.
*/
protected Region loadRegion(FileConfiguration file, String path) {
LocalWorld world = BukkitUtil.getLocalWorld(this.world);
Double minX = file.getDouble(path + ".min.x");
Double minY = file.getDouble(path + ".min.y");
Double minZ = file.getDouble(path + ".min.z");
Double maxX = file.getDouble(path + ".max.x");
Double maxY = file.getDouble(path + ".max.y");
Double maxZ = file.getDouble(path + ".max.z");
return new CuboidRegion(world, new com.sk89q.worldedit.Vector(minX, minY, minZ), new com.sk89q.worldedit.Vector(maxX, maxY, maxZ));
}
示例4: getRegion
import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
private Region getRegion(Player player) {
WorldEditPlugin worldEdit = getWorldEdit();
LocalWorld world = BukkitUtil.getLocalWorld(player.getWorld());
RegionSelector selector = worldEdit.getSession(player)
.getRegionSelector(world);
try {
return selector.getRegion();
} catch (IncompleteRegionException exc) {
throw new WERegionIncomplete(dac);
}
}
示例5: setSelection
import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
private void setSelection(Player sender, Arena arena,
WESelector selectorType, Region region) {
WorldEditPlugin worldEdit = getWorldEdit();
LocalWorld world = BukkitUtil.getLocalWorld(arena.getWorld());
Shape shape = region.getShape();
RegionSelector sel = selectorType.create(dac, world, shape);
LocalSession session = worldEdit.getSession(sender);
session.setRegionSelector(world, sel);
session.dispatchCUISelection(worldEdit.wrapPlayer(sender));
}
示例6: getWorldEditLocation
import com.sk89q.worldedit.bukkit.BukkitUtil; //导入方法依赖的package包/类
/**
* Get the world edit representation of a players location
*
* @return A world edit vector representation of a players location
*/
public com.sk89q.worldedit.Vector getWorldEditLocation() {
Location loc = player.getEyeLocation();
return new WorldVector(BukkitUtil.getLocalWorld(loc.getWorld()),
loc.getX(), loc.getY(), loc.getZ());
}