本文整理汇总了Java中com.sk89q.worldedit.bukkit.BukkitWorld类的典型用法代码示例。如果您正苦于以下问题:Java BukkitWorld类的具体用法?Java BukkitWorld怎么用?Java BukkitWorld使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BukkitWorld类属于com.sk89q.worldedit.bukkit包,在下文中一共展示了BukkitWorld类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: populate
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@Override
public void populate(World world, Random random, Chunk chunk)
{
if (this.bukkitWorld == null)
{
this.bukkitWorld = new BukkitWorld(world);
this.es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(this.bukkitWorld, -1);
this.es.setFastMode(false);
}
if (MathHelper.nextInt(random, 0, 100) == 0)
{
int xFortress = chunk.getX() * 16 + random.nextInt(15);
int zFortress = chunk.getZ() * 16 + random.nextInt(15);
this.generateBlazeFortress(world, xFortress, zFortress);
}
}
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:19,代码来源:FortressPopulator.java
示例2: saveSchematic
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
public void saveSchematic(String file, final String world, final PlotId id) {
Location bot = MainUtil.getPlotBottomLoc(world, id).add(1, 0, 1);
Location top = MainUtil.getPlotTopLoc(world, id);
Vector size = new Vector(top.getX() - bot.getX() + 1, top.getY() - bot.getY() - 1, top.getZ() - bot.getZ() + 1);
Vector origin = new Vector(bot.getX(), bot.getY(), bot.getZ());
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
Vector pos1 = new Vector(bot.getX(), bot.getY(), bot.getZ());
Vector pos2 = new Vector(top.getX(), top.getY(), top.getZ());
EditSession session = PlotSquared.worldEdit.getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(Bukkit.getWorld(world)), 999999999);
clipboard.copy(session);
try {
clipboard.saveSchematic(new File(file));
MainUtil.sendMessage(null, "&7 - &a success: " + id);
} catch (Exception e) {
e.printStackTrace();
MainUtil.sendMessage(null, "&7 - Failed to save &c" + id);
}
}
开发者ID:Mayomi,项目名称:PlotSquared-Chinese,代码行数:19,代码来源:WorldEditSchematic.java
示例3: WorldEditClearFlatlandTask
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
public WorldEditClearFlatlandTask(final uSkyBlock plugin, final CommandSender commandSender, final Region region, final String format) {
super(plugin);
setOnCompletion(new Runnable() {
@Override
public void run() {
String duration = TimeUtil.millisAsString(WorldEditClearFlatlandTask.this.getTimeElapsed());
log(Level.INFO, String.format("Region %s was cleared in %s", region.toString(), duration));
commandSender.sendMessage(String.format(format, duration));
}
});
this.plugin = plugin;
innerChunks = WorldEditHandler.getInnerChunks(region);
borderRegions = WorldEditHandler.getBorderRegions(region);
bukkitWorld = new BukkitWorld(plugin.getWorld());
minY = Math.min(region.getMinimumPoint().getBlockY(), region.getMaximumPoint().getBlockY());
maxY = Math.max(region.getMinimumPoint().getBlockY(), region.getMaximumPoint().getBlockY());
maxBlocks = 2*Math.max(region.getLength(), region.getWidth())*16*(maxY-minY);
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:19,代码来源:WorldEditClearFlatlandTask.java
示例4: saveRegionBlocks
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@Override
public boolean saveRegionBlocks(File file, GeneralRegionInterface regionInterface) {
boolean result = true;
ProtectedRegion region = regionInterface.getRegion();
// Get the origin and size of the region
Vector origin = new Vector(region.getMinimumPoint().getBlockX(), region.getMinimumPoint().getBlockY(), region.getMinimumPoint().getBlockZ());
Vector size = (new Vector(region.getMaximumPoint().getBlockX(), region.getMaximumPoint().getBlockY(), region.getMaximumPoint().getBlockZ()).subtract(origin)).add(new Vector(1, 1, 1));
EditSession editSession = new EditSession(new BukkitWorld(regionInterface.getWorld()), pluginInterface.getConfig().getInt("maximumBlocks"));
// Save the schematic
editSession.enableQueue();
CuboidClipboard clipboard = new CuboidClipboard(size, origin);
clipboard.copy(editSession);
Exception otherException = null;
try {
SchematicFormat.MCEDIT.save(clipboard, file);
} catch(DataException | IOException e) {
otherException = e;
}
if(otherException != null) {
pluginInterface.getLogger().warning("Failed to save schematic for region " + regionInterface.getName());
pluginInterface.debugI(ExceptionUtils.getStackTrace(otherException));
result = false;
}
editSession.flushQueue();
return result;
}
开发者ID:NLthijs48,项目名称:AreaShop,代码行数:27,代码来源:WorldEditHandler5.java
示例5: spawnTree
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
private void spawnTree(Location startBlock, String fileName, Vector offset){
BukkitWorld world = new BukkitWorld(startBlock.getWorld());
EditSession session = new EditSession(world, 1000);
WorldEditPlugin wep = ((WorldEditPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldEdit"));
WorldEdit we = wep.getWorldEdit();
LocalConfiguration config = we.getConfiguration();
BukkitPlayer p = wep.wrapPlayer(startBlock.getWorld().getPlayers().get(0));
File dir = we.getWorkingDirectoryFile(config.saveDir);
File f;
Vector v = new Vector(startBlock.getX(), startBlock.getY(), startBlock.getZ());
try {
f = we.getSafeOpenFile(p, dir, fileName, "schematic", "schematic");
CuboidClipboard cc = SchematicFormat.MCEDIT.load(f);
cc.setOffset(offset);
cc.paste(session, v, true);
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:22,代码来源:TreeListener.java
示例6: rawSetBlock
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@Override
public boolean rawSetBlock(Vector pt, BaseBlock block)
{
if (this.player instanceof BukkitPlayer && this.player.getWorld() instanceof BukkitWorld)
{
World world = ((BukkitWorld)this.player.getWorld()).getWorld();
BlockState oldState = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getState();
boolean success = super.rawSetBlock(pt, block);
if (success)
{
ActionWorldEdit action = this.listener.newAction(ActionWorldEdit.class, world);
if (action != null)
{
BlockState newState = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getState();
action.setOldBlock(oldState);
action.setNewBlock(newState);
action.setPlayer(((BukkitPlayer)this.player).getPlayer());
action.setLocation(newState.getLocation());
this.listener.logAction(action);
}
}
return success;
}
return super.rawSetBlock(pt, block);
}
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:26,代码来源:LogEditSession.java
示例7: saveWEChunk
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
private void saveWEChunk(Chunk chunk, File saveFile)
{
WorldEditPlugin wep = (WorldEditPlugin)Bukkit.getPluginManager().getPlugin("WorldEdit");
if (wep == null)
{
Bukkit.broadcastMessage(ChatColor.RED+"Unable to find WorldEdit plugin - Unable to restore.");
return;
}
EditSession editSession = new EditSession(new BukkitWorld(chunk.getWorld()), 1000);
Vector startPos = locationToVector(chunk.getBlock(0, 0, 0).getLocation());
Vector size = new Vector(16,256,16);
CuboidClipboard clipboard = new CuboidClipboard(size, startPos);
clipboard.copy(editSession);
try
{
SchematicFormat.MCEDIT.save(clipboard, saveFile);
}
catch (Exception e)
{
e.printStackTrace();
}
}
开发者ID:marsglorious,项目名称:NewNations,代码行数:24,代码来源:PlotRestoreManager.java
示例8: place
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
/**
* Place the waiting lobby in the world
*/
public void place()
{
this.logger.info("Generating lobby...");
if (this.file.exists())
{
try
{
Vector vector = new Vector(0, 190, 0);
World world = Bukkit.getWorld("world");
world.loadChunk(0, 0);
BukkitWorld bwf = new BukkitWorld(world);
this.editSession = new EditSession(bwf, -1);
this.editSession.setFastMode(true);
CuboidClipboard c1 = SchematicFormat.MCEDIT.load(this.file);
c1.paste(this.editSession, vector, true);
}
catch (MaxChangedBlocksException | IOException | DataException ex)
{
this.logger.log(Level.SEVERE, "Error in world", ex);
}
}
else
{
this.logger.severe("File does not exist. Abort...");
}
this.logger.info("Done.");
}
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:38,代码来源:LobbyPopulator.java
示例9: loadSchematic
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static void loadSchematic(World world, int size, Vector v) throws Exception {
if (getRandomCasa(size) == null) {
return;
}
EditSession es = new EditSession(new BukkitWorld(world), Integer.MAX_VALUE);
CuboidClipboard cc = CuboidClipboard.loadSchematic(getRandomCasa(size));
cc.paste(es, v, false);
cc.paste(es, v, false);
}
开发者ID:leonardosnt,项目名称:OldBukkit,代码行数:11,代码来源:TerrenosManager.java
示例10: execute
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@Override
protected void execute(Event e) {
File file;
if (name.getSingle(e).startsWith("/")) {
file = new File(
(name.getSingle(e) + ".schematic").replaceAll("/", Matcher.quoteReplacement(File.separator)));
} else {
file = new File(
("plugins/WorldEdit/schematics/" + (name.getSingle(e).contains(".") ? name.getSingle(e)
: new StringBuilder(String.valueOf(name.getSingle(e))).append(".schematic").toString()))
.replaceAll("/", Matcher.quoteReplacement(File.separator)));
}
Vector v = new Vector(loc.getSingle(e).getBlockX(), loc.getSingle(e).getBlockY(), loc.getSingle(e).getBlockZ());
Bukkit.getScheduler().runTaskAsynchronously(Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit"),
new Runnable() {
@Override
public void run() {
try {
Boolean excludeair = false;
if (exair != null) {
excludeair = exair.getSingle(e);
}
Schematic schem = FaweAPI.load(file);
EditSession ext = schem.paste(new BukkitWorld(loc.getSingle(e).getWorld()), v, false,
excludeair, null);
} catch (IOException e1) {
main core = (main) Bukkit.getPluginManager().getPlugin("SharpSK");
core.getLogger().warning("Failed to paste schematic: " + "\"" + name.getSingle(e) + "\""
+ " An error occurred");
return;
}
}
});
}
开发者ID:Sharpjaws,项目名称:SharpSK,代码行数:41,代码来源:EffFAWEPasteSchematic.java
示例11: save
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
public void save(UUID uuid, Chunk chunk, String snapshotName) {
if (this.hasValidAdapter) {
try {
File schematicFile = getSnapshotFileLocation(uuid, snapshotName);
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory()
.getEditSession(new BukkitWorld(chunk.getWorld()), 0x3b9ac9ff);
Vector minPoint = new Vector(chunk.getX() * 16, 0, chunk.getZ() * 16);
Vector maxPoint = new Vector(chunk.getX() * 16 + 15, 256, chunk.getZ() * 16 + 15);
editSession.enableQueue();
CuboidClipboard clipboard = new CuboidClipboard(maxPoint.subtract(minPoint).add(new Vector(1, 1, 1)),
minPoint);
clipboard.copy(editSession);
SchematicFormat.MCEDIT.save(clipboard, schematicFile);
editSession.flushQueue();
} catch (DataException | IOException ex) {
ex.printStackTrace();
}
for (Entity entity : chunk.getEntities()) {
if (entity instanceof LivingEntity) {
moveEntityToTop(entity);
}
}
}
}
开发者ID:MineGaming,项目名称:cubit,代码行数:30,代码来源:WorldEditFunctions.java
示例12: paste
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
public void paste(final UUID uuid, final String snapshotName, final Chunk chunk) {
if (this.hasValidAdapter) {
final Location pasteLoc = convertChunkLocation(chunk);
final File snapshotFile = getSnapshotFileLocation(uuid, snapshotName);
Bukkit.getScheduler().runTask(CubitBukkitPlugin.inst(), () -> {
try {
EditSession editSession = new EditSession(new BukkitWorld(pasteLoc.getWorld()),
Integer.MAX_VALUE);
editSession.enableQueue();
SchematicFormat snapshot = SchematicFormat.getFormat(snapshotFile);
CuboidClipboard clipboard = snapshot.load(snapshotFile);
clipboard.paste(editSession, BukkitUtil.toVector(pasteLoc), false, true);
editSession.flushQueue();
} catch (MaxChangedBlocksException | DataException | IOException ex) {
ex.printStackTrace();
}
for (Entity entity : chunk.getEntities()) {
if (entity instanceof LivingEntity) {
moveEntityToTop(entity);
}
}
});
}
}
开发者ID:MineGaming,项目名称:cubit,代码行数:29,代码来源:WorldEditFunctions.java
示例13: ByteSchematic
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
/**
* Constructor
*
* @param wep the WorldEdit plugin instance
* @param world the world to work in
*/
public ByteSchematic(WorldEditPlugin wep, World world) {
we = wep.getWorldEdit();
localPlayer = null;
localSession = new LocalSession(we.getConfiguration());
editSession = new EditSession(new BukkitWorld(world), we.getConfiguration().maxChangeLimit);
}
开发者ID:VirtualByte,项目名称:ByteUtils,代码行数:13,代码来源:ByteSchematic.java
示例14: pasteWithWE
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
public static void pasteWithWE(Player p, File file) {
World world = p.getWorld();
Location loc = p.getLocation();
EditSession es = new EditSession(new BukkitWorld(world), 999999999);
try {
CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
cc.paste(es, new com.sk89q.worldedit.Vector(loc.getX(),loc.getY(),loc.getZ()), false);
} catch (DataException | IOException | MaxChangedBlocksException e) {
e.printStackTrace();
}
}
开发者ID:FabioZumbi12,项目名称:RedProtect,代码行数:13,代码来源:WEListener.java
示例15: regenerate
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
/**
* Pastes a schematic into the room.
*/
private void regenerate() {
try {
Location location = sign.getLocation();
CuboidClipboard clipboard = schematic.load(schematicFile);
BukkitWorld world = new BukkitWorld(location.getWorld());
WorldEditPlugin we = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
EditSession editSession = we.getWorldEdit().getEditSessionFactory().getEditSession(world, 64*64*64);
Vector newOrigin = region.getMinimumPoint();
clipboard.paste(editSession, newOrigin, false);
} catch (DataException | MaxChangedBlocksException | IOException e) {
e.printStackTrace();
}
}
开发者ID:Co0sh,项目名称:RoomRent,代码行数:17,代码来源:SingleRoom.java
示例16: loadIslandSchematic
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@Override
public void loadIslandSchematic(final File file, final Location origin, final PlayerPerk playerPerk) {
final IAsyncWorldEdit awe = getAWE();
BukkitWorld bukkitWorld = new BukkitWorld(origin.getWorld());
Player player = Bukkit.getPlayer(playerPerk.getPlayerInfo().getUniqueId());
int maxBlocks = (255 * Settings.island_protectionRange * Settings.island_protectionRange);
IPlayerManager pm = awe.getPlayerManager();
final IPlayerEntry playerEntry = pm.getUnknownPlayer();
IThreadSafeEditSession tsSession = (IThreadSafeEditSession) createEditSession(bukkitWorld, maxBlocks);
IFuncParamEx<Integer, ICancelabeEditSession, MaxChangedBlocksException> action = new PasteAction(bukkitWorld, origin, file);
registerCompletion(player);
awe.getBlockPlacer().performAsAsyncJob(tsSession, playerEntry, "loadIslandSchematic:"+playerPerk.getPlayerInfo().getPlayerName(), action);
if (timerTask != null) {
timerTask.cancel();
}
timerTask = uSkyBlock.getInstance().async(new Runnable() {
int maxSize = -1;
@Override
public void run() {
IBlockPlacerPlayer playerEvents = awe.getBlockPlacer().getPlayerEvents(playerEntry);
if (playerEvents != null) {
int size = playerEvents.getQueue().size();
if (maxSize == -1 || size > maxSize) {
maxSize = size;
}
updateProgress(playerEntry, size, maxSize);
} else {
updateProgress(playerEntry, 0, maxSize);
timerTask.cancel();
}
}
}, 500, 500);
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:34,代码来源:AWE330Adaptor.java
示例17: loadIslandSchematic
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@Override
public void loadIslandSchematic(final File file, final Location origin, final PlayerPerk playerPerk) {
AsyncWorldEditMain awe = getAWE();
WorldEdit worldEdit = WorldEditHandler.getWorldEdit().getWorldEdit();
BukkitWorld bukkitWorld = new BukkitWorld(origin.getWorld());
Player player = Bukkit.getPlayer(playerPerk.getPlayerInfo().getUniqueId());
int maxBlocks = (255 * Settings.island_protectionRange * Settings.island_protectionRange);
PlayerEntry playerEntry = PlayerEntry.UNKNOWN;
ThreadSafeEditSession tsSession = ((AsyncEditSessionFactory) worldEdit.getEditSessionFactory()).getThreadSafeEditSession(bukkitWorld, maxBlocks, null, playerEntry);
FuncParamEx<Integer, CancelabeEditSession, MaxChangedBlocksException> action = new PasteAction(bukkitWorld, origin, file);
registerCompletion(player);
awe.getBlockPlacer().performAsAsyncJob(tsSession, playerEntry, "loadIslandSchematic", action);
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:14,代码来源:AWE211Adaptor.java
示例18: loadIslandSchematic
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@Override
public void loadIslandSchematic(final File file, final Location origin, final PlayerPerk playerPerk) {
IAsyncWorldEdit awe = getAWE();
BukkitWorld bukkitWorld = new BukkitWorld(origin.getWorld());
Player player = Bukkit.getPlayer(playerPerk.getPlayerInfo().getUniqueId());
int maxBlocks = (255 * Settings.island_protectionRange * Settings.island_protectionRange);
IPlayerManager pm = awe.getPlayerManager();
IPlayerEntry playerEntry = pm.getConsolePlayer();
ThreadSafeEditSession tsSession = createEditSession(bukkitWorld, maxBlocks);
FuncParamEx<Integer, CancelabeEditSession, MaxChangedBlocksException> action = new PasteAction(bukkitWorld, origin, file);
registerCompletion(player);
awe.getBlockPlacer().performAsAsyncJob(tsSession, playerEntry, "loadIslandSchematic", action);
}
开发者ID:rlf,项目名称:uSkyBlock,代码行数:14,代码来源:AWE311Adaptor.java
示例19: run
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
@Override
public void run(String playerID) throws QuestRuntimeException {
try {
Location location = loc.getLocation(playerID);
SchematicFormat schematic = SchematicFormat.getFormat(file);
CuboidClipboard clipboard = schematic.load(file);
BukkitWorld world = new BukkitWorld(location.getWorld());
EditSession editSession = we.getWorldEdit().getEditSessionFactory().getEditSession(world, 64*64*64);
Vector newOrigin = BukkitUtil.toVector(location);
clipboard.paste(editSession, newOrigin, noAir);
} catch (DataException | IOException | MaxChangedBlocksException e) {
Debug.error("Error while pasting a schematic: " + e.getMessage());
}
}
开发者ID:Co0sh,项目名称:BetonQuest,代码行数:15,代码来源:PasteSchematicEvent.java
示例20: Game
import com.sk89q.worldedit.bukkit.BukkitWorld; //导入依赖的package包/类
public Game(HeavySpleef heavySpleef, String name, World world) {
this.heavySpleef = heavySpleef;
this.name = name;
this.world = world;
this.worldEditWorld = new BukkitWorld(world);
this.i18n = I18NManager.getGlobal();
this.ingamePlayers = Sets.newLinkedHashSet();
this.deadPlayers = Lists.newArrayList();
this.eventBus = heavySpleef.getGlobalEventBus().newChildBus();
this.statisticRecorder = new StatisticRecorder(heavySpleef, heavySpleef.getLogger());
this.regeneratorFactory = new FloorRegeneratorFactory();
this.killedPlayers = Lists.newArrayList();
this.killedLobbyPlayers = Lists.newArrayList();
eventBus.registerListener(statisticRecorder);
setGameState(GameState.WAITING);
DefaultConfig configuration = heavySpleef.getConfiguration(ConfigType.DEFAULT_CONFIG);
FlagManager.GamePropertyBundle defaults = new FlagManager.DefaultGamePropertyBundle(configuration.getProperties());
this.flagManager = new FlagManager(heavySpleef.getPlugin(), defaults);
this.extensionManager = heavySpleef.getExtensionRegistry().newManagerInstance(eventBus);
this.deathzones = Maps.newHashMap();
this.blocksBroken = HashBiMap.create();
this.killDetector = new DefaultKillDetector();
this.queuedPlayers = new LinkedList<SpleefPlayer>();
this.spawnLocationQueue = new LinkedList<Location>();
//Concurrent map for database schematics
this.floors = new ConcurrentHashMap<String, Floor>();
WorldEditHook hook = (WorldEditHook) heavySpleef.getHookManager().getHook(HookReference.WORLDEDIT);
WorldEdit worldEdit = hook.getWorldEdit();
this.editSessionFactory = worldEdit.getEditSessionFactory();
GeneralSection generalSection = configuration.getGeneralSection();
this.joinRequester = new JoinRequester(this, heavySpleef.getPvpTimerManager());
this.joinRequester.setPvpTimerMode(generalSection.getPvpTimer() > 0);
}
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:41,代码来源:Game.java
注:本文中的com.sk89q.worldedit.bukkit.BukkitWorld类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论