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


Java DataException类代码示例

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


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

示例1: saveTerrain

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

示例2: loadSchematic

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

示例3: loadIslandSchematic

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

示例4: saveRegionBlocks

import com.sk89q.worldedit.data.DataException; //导入依赖的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: loadBounds

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

示例6: save

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

示例7: paste

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

示例8: regenerate

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

示例9: run

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

示例10: saveClipboardToFile

import com.sk89q.worldedit.data.DataException; //导入依赖的package包/类
private static void saveClipboardToFile(CuboidClipboard clip, String name, File animationFolder) {
    SchematicFormat sf = SchematicFormat.MCEDIT;
    try {
        File data = new File(animationFolder + File.separator + name + ".schematic");
        sf.save(clip, data);
        //p.sendMessage("File " + data.getAbsolutePath() + " saved!");
    } catch (IOException | DataException ex) {
        Logger.getLogger(AnimationFactory.class.getName()).log(Level.SEVERE, null, ex);
    }

}
 
开发者ID:MCME,项目名称:Animations-Redux,代码行数:12,代码来源:AnimationFactory.java

示例11: loadFrame

import com.sk89q.worldedit.data.DataException; //导入依赖的package包/类
public static CuboidClipboard loadFrame(String frameName) {

        try {
            SchematicFormat sf = MCEditSchematicFormat.MCEDIT;
            CuboidClipboard clip = sf.load(new File(MCMEAnimations.MCMEAnimationsInstance.getDataFolder() + File.separator + "schematics" + File.separator + "animations" + File.separator + frameName + ".schematic"));
            return clip;
        } catch (IOException | DataException ex) {
            Logger.getLogger(WELoader.class.getName()).log(Level.SEVERE, null, ex);
        }

        return null;
    }
 
开发者ID:MCME,项目名称:Animations-Redux,代码行数:13,代码来源:WELoader.java

示例12: loadArea

import com.sk89q.worldedit.data.DataException; //导入依赖的package包/类
private static void loadArea(World world, File file, Vector origin)
		throws DataException, IOException, MaxChangedBlocksException {
	SchematicFormat schematic = SchematicFormat.MCEDIT;
	CuboidClipboard clipboard = schematic.load(file);
	clipboard.paste(new EditSession(new BukkitWorld(world), 20000), origin,
			true);
}
 
开发者ID:mineglow-network,项目名称:HyperDriveCraft,代码行数:8,代码来源:Spacestation.java

示例13: getChildTag

import com.sk89q.worldedit.data.DataException; //导入依赖的package包/类
private static <T extends Tag> T getChildTag(Map<String, Tag> items, String key, Class<T> expected) throws DataException {
	return expected.cast(items.get(key));
}
 
开发者ID:maker56,项目名称:UltimateSurvivalGames,代码行数:4,代码来源:Reset.java


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