本文整理汇总了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();
}
}
示例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);
}
示例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);
}
示例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();
}
示例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.");
}
}