capybebra
Новичок
- Баллы
- 16
- Имя в Minecraft
- mmmiiikk
Пытаюсь сделать метод, в котором схематика из папки плагина будет спавниться на рандомных координатах.
Проблема:
в 11 строчке выскакивает ошибка: 'getEditSession(com.sk89q.worldedit.world.World, int)' in 'com.sk89q.worldedit.EditSessionFactory' cannot be applied to '(org.bukkit.World, int)'
код:
private void buildSchematic(File schemFile) {
File schemFile1 = new File(getDataFolder(), "CapyZamok/ebatzamok.schem");
try {
ClipboardFormat format = ClipboardFormats.findByFile(schemFile1);
try (ClipboardReader reader = format.getReader(new FileInputStream(schemFile1))) {
Clipboard clipboard = reader.read();
World world = getServer().getWorld("world");
Random random = new Random();
int x = random.nextInt(10000) - 5000;
int z = random.nextInt(10000) - 5000;
int y = world.getHighestBlockYAt(x, z);
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
Operation operation = new ClipboardHolder(clipboard)
.createPaste(editSession)
.to(BlockVector3.at(x, y, z))
.ignoreAirBlocks(false)
.build();
Operations.complete(operation);
} catch (WorldEditException e) {
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
Проблема:
в 11 строчке выскакивает ошибка: 'getEditSession(com.sk89q.worldedit.world.World, int)' in 'com.sk89q.worldedit.EditSessionFactory' cannot be applied to '(org.bukkit.World, int)'
код:
private void buildSchematic(File schemFile) {
File schemFile1 = new File(getDataFolder(), "CapyZamok/ebatzamok.schem");
try {
ClipboardFormat format = ClipboardFormats.findByFile(schemFile1);
try (ClipboardReader reader = format.getReader(new FileInputStream(schemFile1))) {
Clipboard clipboard = reader.read();
World world = getServer().getWorld("world");
Random random = new Random();
int x = random.nextInt(10000) - 5000;
int z = random.nextInt(10000) - 5000;
int y = world.getHighestBlockYAt(x, z);
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
Operation operation = new ClipboardHolder(clipboard)
.createPaste(editSession)
.to(BlockVector3.at(x, y, z))
.ignoreAirBlocks(false)
.build();
Operations.complete(operation);
} catch (WorldEditException e) {
e.printStackTrace();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}