Untitled
unknown
java
9 months ago
1.6 kB
3
Indexable
public static boolean generateFarmworldIsland(Location middleLocation) { try { Location pasteLocation = new Location(middleLocation.getWorld(), middleLocation.getX() - 28, middleLocation.getY() - 24, middleLocation.getZ() - 26); File schematicFile = new File(LaserServerManager.getPlugin(LaserServerManager.class).getDataFolder().getAbsolutePath() + "/farmworld_spawn.litematic"); Clipboard clipboard; ClipboardFormat format = ClipboardFormats.findByFile(schematicFile); try (ClipboardReader reader = format.getReader(new FileInputStream(schematicFile))) { clipboard = reader.read(); } catch (Exception e) { e.printStackTrace(); return false; } com.sk89q.worldedit.world.World adaptedWorld = BukkitAdapter.adapt(middleLocation.getWorld()); try (EditSession editSession = WorldEdit.getInstance().newEditSession(adaptedWorld)) { Operation operation = new ClipboardHolder(clipboard) .createPaste(editSession) .to(BlockVector3.at(pasteLocation.getX(), pasteLocation.getY(), pasteLocation.getZ())) .build(); Operations.complete(operation); return true; } catch (Exception e) { e.printStackTrace(); return false; } } catch (Exception e) { e.printStackTrace(); return false; } }
Editor is loading...
Leave a Comment