当前位置: 首页>>代码示例>>Java>>正文


Java SchematicFormat类代码示例

本文整理汇总了Java中com.sk89q.worldedit.schematic.SchematicFormat的典型用法代码示例。如果您正苦于以下问题:Java SchematicFormat类的具体用法?Java SchematicFormat怎么用?Java SchematicFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SchematicFormat类属于com.sk89q.worldedit.schematic包,在下文中一共展示了SchematicFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: FortressPopulator

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的package包/类
public FortressPopulator(SurvivalGenerator plugin)
{
    this.plugin = plugin;
    this.logger = plugin.getLogger();

    try
    {
        this.netherHouse = SchematicFormat.MCEDIT.load(new File(plugin.getDataFolder(), "/uhcrun_nether_1.schematic"));
        this.netherFortress = SchematicFormat.MCEDIT.load(new File(plugin.getDataFolder(), "/uhcrun_nether_2.schematic"));
    }
    catch (IOException | DataException e)
    {
        e.printStackTrace();
    }

    this.random = new Random();
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:18,代码来源:FortressPopulator.java

示例2: FlagPopulator

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的package包/类
FlagPopulator(SurvivalGenerator plugin)
{
    this.plugin = plugin;
    this.locations = new ArrayList<>();
    this.done = false;

    try
    {
        this.flag = SchematicFormat.MCEDIT.load(new File(plugin.getDataFolder(), "/ufk_flag.schematic"));

        List<String> locs = this.plugin.getConfig().getStringList("flags");
        locs.forEach(string ->
        {
            String[] split = string.split(", ");
            this.locations.add(Pair.of(new Location(this.plugin.getServer().getWorld(split[0]), Double.parseDouble(split[1]), Double.parseDouble(split[2]), Double.parseDouble(split[3])), Byte.parseByte(split[4])));
        });
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:SamaGames,项目名称:SurvivalAPI,代码行数:23,代码来源:FlagPopulator.java

示例3: saveTerrain

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的package包/类
/**
 * Write the terrain bounded by the given locations to the given file as a MCedit format
 * schematic.
 *
 * @param saveFile a File representing the schematic file to create
 * @param l1       one corner of the region to save
 * @param l2       the corner of the region to save, opposite to l1
 * @throws DataException
 * @throws IOException
 */
public void saveTerrain(File saveFile, Location l1, Location l2) throws FilenameException, DataException, IOException {
    Vector min = getMin(l1, l2);
    Vector max = getMax(l1, l2);

    try {
        saveFile = we.getSafeSaveFile(localPlayer,
                saveFile.getParentFile(), saveFile.getName(),
                EXTENSION, new String[]{EXTENSION});
    } catch (FilenameException e) {
        e.printStackTrace();
    }

    editSession.enableQueue();
    CuboidClipboard clipboard = new CuboidClipboard(max.subtract(min).add(new Vector(1, 1, 1)), min);
    clipboard.copy(editSession);
    SchematicFormat.MCEDIT.save(clipboard, saveFile);
    editSession.flushQueue();
}
 
开发者ID:VirtualByte,项目名称:ByteUtils,代码行数:29,代码来源:ByteSchematic.java

示例4: SingleRoom

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的package包/类
/**
 * Creates a room with specified region and sign location.
 *
 * @param region
 *            name of the WorldGuard region
 * @param signLoc
 *            location of the room sign
 * @throws Exception
 */
public SingleRoom(RoomRent plugin, World world, String regionName, String signLoc) throws RoomException {
	this.world = world;
	this.plugin = plugin;
	region = WorldGuardPlugin.inst().getRegionManager(world).getRegion(regionName);
	if (region == null) {
		throw new RoomException("Region with given name does not exist!");
	}
	sign = getBlock(signLoc, world);
	FileConfiguration config = plugin.getDB().getConfig();
	String rawRenter = config.getString(world.getName() + "." + regionName + ".player");
	renter = (rawRenter == null) ? null : Bukkit.getOfflinePlayer(UUID.fromString(rawRenter));
	String rawTime = config.getString(world.getName() + "." + regionName + ".time");
	time = (rawTime == null) ? -1 : Long.parseLong(rawTime);
	schematicFile = new File(plugin.getDataFolder(), sign.getWorld().getName() + File.separator + regionName);
	if (schematicFile.exists()) {
		schematic = SchematicFormat.getFormat(schematicFile);
	}
}
 
开发者ID:Co0sh,项目名称:RoomRent,代码行数:28,代码来源:SingleRoom.java

示例5: loadSchematic

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的package包/类
public void loadSchematic() {
	String formatName = null;

	File f = new File("plugins//BlockParty//Floors//" + this.floorName + ".schematic");
	if (!f.exists()) {
		return;
	}
	SchematicFormat format = formatName == null ? null : SchematicFormat.getFormat(formatName);
	if (format == null) {
		format = SchematicFormat.getFormat(f);
	}
	if (format == null) {
		return;
	}
	try {
		this.size = format.load(f).getSize();
		this.sh = format.load(f);
	} catch (DataException localDataException) {
	} catch (IOException localIOException) {
	}
}
 
开发者ID:Hansdekip,项目名称:BlockParty-1.8,代码行数:22,代码来源:LoadFloor.java

示例6: loadIslandSchematic

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的package包/类
@Override
public void loadIslandSchematic(final File file, final Location origin, final PlayerPerk playerPerk) {
    plugin.async(new Runnable() {
        @Override
        public void run() {
            boolean noAir = false;
            boolean entities = true;
            Vector to = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
            EditSession editSession = getEditSession(playerPerk, origin);
            try {
                SchematicFormat.getFormat(file)
                        .load(file)
                        .paste(editSession, to, noAir, entities);
                editSession.flushQueue();
            } catch (MaxChangedBlocksException | IOException | DataException e) {
                log.log(Level.INFO, "Unable to paste schematic " + file, e);
            }
        }
    });
}
 
开发者ID:rlf,项目名称:uSkyBlock,代码行数:21,代码来源:FAWEAdaptor.java

示例7: saveRegionBlocks

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的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

示例8: spawnTree

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的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

示例9: saveWEChunk

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的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

示例10: loadBounds

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的package包/类
public static CuboidRegion loadBounds(String frameName, MCMEAnimation animation) {
    SchematicFormat sf = MCEditSchematicFormat.MCEDIT;
    try {
        CuboidClipboard clip = sf.load(new File(MCMEAnimations.MCMEAnimationsInstance.getDataFolder() + File.separator + "schematics" + File.separator + "animations" + File.separator + frameName + ".schematic"));

        Vector v1 = new Vector(animation.origin.getX() + clip.getOffset().getX(), animation.origin.getY() + clip.getOffset().getY(), animation.origin.getZ() + clip.getOffset().getZ());
        Vector v2 = new Vector(Math.floor(animation.origin.getX() + clip.getWidth() + clip.getOffset().getX() - 1),
                Math.floor(animation.origin.getY() + clip.getHeight() + clip.getOffset().getY() - 1),
                Math.floor(animation.origin.getZ() + clip.getLength() + clip.getOffset().getZ() - 1));

        return new CuboidRegion(v1, v2);

    } catch (IOException | DataException ex) {
        Logger.getLogger(WELoader.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}
 
开发者ID:MCME,项目名称:Animations-Redux,代码行数:18,代码来源:WELoader.java

示例11: place

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的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

示例12: save

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的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

示例13: paste

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的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

示例14: checkForOutdatedArenaSaveFiles

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的package包/类
public static void checkForOutdatedArenaSaveFiles() {
	File f = new File("plugins/SurvivalGames/reset/");
	List<String> outdated = new ArrayList<>();
	if(f.exists()) {
		for(String key : f.list()) {
			if(!key.endsWith(".map"))
				continue;
			File file = new File("plugins/SurvivalGames/reset/" + key);
			SchematicFormat sf = SchematicFormat.getFormat(file);
			if(sf == null) {
				outdated.add(key);
				
			}
		}
	}
	String s = null;
	if(!outdated.isEmpty()) {
		s = MessageHandler.getMessage("prefix") + "�cThe format of " + outdated.size() + " map saves is outdated�7: �e";
		for(int i = 0; i < outdated.size(); i++) {
			s+= outdated.get(i);
			if(i != outdated.size() - 1) {
				s+= "�7, �e";
			} else {
				s+= " �c! ";
			}
			

		}
		s+= "Select all the arenas with �l/sg arena select �cand type �c�l/sg arena save�c! In the old format, the arenas will not reset!";
	}
	UpdateListener.setOutdatedMaps(s);
}
 
开发者ID:maker56,项目名称:UltimateSurvivalGames,代码行数:33,代码来源:Util.java

示例15: run

import com.sk89q.worldedit.schematic.SchematicFormat; //导入依赖的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


注:本文中的com.sk89q.worldedit.schematic.SchematicFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。