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


Java WorldEditPlugin.getWorldEdit方法代码示例

本文整理汇总了Java中com.sk89q.worldedit.bukkit.WorldEditPlugin.getWorldEdit方法的典型用法代码示例。如果您正苦于以下问题:Java WorldEditPlugin.getWorldEdit方法的具体用法?Java WorldEditPlugin.getWorldEdit怎么用?Java WorldEditPlugin.getWorldEdit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldedit.bukkit.WorldEditPlugin的用法示例。


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

示例1: spawnTree

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入方法依赖的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

示例2: ByteSchematic

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入方法依赖的package包/类
/**
 * Constructor
 *
 * @param wep    the WorldEdit plugin instance
 * @param player the player to work with
 */
public ByteSchematic(JavaPlugin plugin, Player player) throws UnsupportedPluginException {
    if(plugin instanceof WorldEditPlugin) {
        throw new UnsupportedPluginException("JavaPlugin parameter is an instance of WorldEditPlugin");
    }

    WorldEditPlugin wep = (WorldEditPlugin) plugin;
    we = wep.getWorldEdit();
    localPlayer = wep.wrapPlayer(player);
    localSession = we.getSession(localPlayer);
    editSession = localSession.createEditSession(localPlayer);
}
 
开发者ID:VirtualByte,项目名称:ByteUtils,代码行数:18,代码来源:ByteSchematic.java

示例3: DrawingTask

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入方法依赖的package包/类
public DrawingTask(WorldEditPlugin worldEditPlugin, Player player) {
    WorldEdit worldEdit = worldEditPlugin.getWorldEdit();
    
    final AsyncEditSessionFactory factory = (AsyncEditSessionFactory)worldEdit.getEditSessionFactory();
    
    m_player = player;
    m_localPlayer = worldEditPlugin.wrapPlayer(player);
    m_lSession = worldEditPlugin.getSession(player);   
    
    m_editSession = factory.getThreadSafeEditSession(m_localPlayer.getWorld(), 
            m_lSession.getBlockChangeLimit() , m_lSession.getBlockBag(m_localPlayer), m_localPlayer);
}
 
开发者ID:SBPrime,项目名称:MCPainter,代码行数:13,代码来源:DrawingTask.java

示例4: getWorldEdit

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入方法依赖的package包/类
public WorldEdit getWorldEdit() {
	if (!isProvided()) {
		throw new IllegalStateException("The WorldEdit hook is not provided");
	}
	
	WorldEditPlugin plugin = (WorldEditPlugin) getPlugin();
	return plugin.getWorldEdit();
}
 
开发者ID:xaniox,项目名称:HeavySpleef,代码行数:9,代码来源:WorldEditHook.java

示例5: clearSpawner

import com.sk89q.worldedit.bukkit.WorldEditPlugin; //导入方法依赖的package包/类
private void clearSpawner(Sign spawner, Player clicker){
	Long timestamp = data.get(spawner.getLocation());
	System.out.println("timestamp: " + timestamp);
	if(timestamp == null){
		timestamp = STARTUP_TIME + 180000;
	}
	if((System.currentTimeMillis() - timestamp) > SPAWNER_TIMEOUT){
		BlockFace direction = DirectionUtils.getSignDirection(spawner.getBlock());
		Location startBlock = spawner.getBlock().getRelative(direction, 2).getLocation();
		BukkitWorld world = new BukkitWorld(startBlock.getWorld());
		EditSession session = new EditSession(world, 1000);
		WorldEditPlugin wep = ((WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit"));
		WorldEdit we = wep.getWorldEdit();
		LocalConfiguration config = we.getConfiguration();
		LocalPlayer p = wep.wrapPlayer(clicker);
		String fileName = getSchematicName(spawner);
		//int price = getPrice(spawner);
		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);
			int originX = startBlock.getBlockX();
			int originY = startBlock.getBlockY();
			int originZ = startBlock.getBlockZ();
			
			Vector v2 = generateFarPointVector(cc, startBlock, direction);
			
			CuboidSelection sr = new CuboidSelection(startBlock.getWorld(), v, v2);
			Location minPoint = sr.getMinimumPoint();
			for (int X = 0; X < sr.getWidth(); X++) {
				for (int Y = 0; Y < sr.getHeight(); Y++) {
					for (int Z = 0; Z < sr.getLength(); Z++) {
						Location l = new Location(startBlock.getWorld(), minPoint.getX() + X, minPoint.getY() + Y, minPoint.getZ() + Z);
						l.getBlock().setType(Material.AIR);
					}
				}
			}
		} catch (Exception e){
			e.printStackTrace();
		}
		clicker.sendMessage("Spawner Cleared!");
	} else {
		clicker.sendMessage("This spawner cannot be cleared yet. It has been used in the last two minutes.");
		long time = (SPAWNER_TIMEOUT - (System.currentTimeMillis() - timestamp)) / 1000;
		clicker.sendMessage("It can be cleared in " + time + " seconds.");
	}
}
 
开发者ID:StarQuestMinecraft,项目名称:StarQuestCode,代码行数:51,代码来源:ShipSpawnerCore.java


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