MCPcopy Create free account
hub / github.com/boxbeam/RedLib / export

Method export

src/redempt/redlib/dev/StructureTool.java:135–158  ·  view source on GitHub ↗
(Player player, String filename)

Source from the content-addressed store, hash-verified

133 }
134
135 @SuppressWarnings("deprecation")
136 @CommandHook("export")
137 public void export(Player player, String filename) {
138 Location[] locs = locations.get(player.getUniqueId());
139 if (locs[0] == null || locs[1] == null) {
140 player.sendMessage(ChatColor.RED + "You must set 2 locations with the structure wand (/struct wand) first!");
141 return;
142 }
143 if (!locs[0].getWorld().equals(locs[1].getWorld())) {
144 player.sendMessage(ChatColor.RED + "Locations must be in the same world!");
145 return;
146 }
147 player.sendMessage(ChatColor.GREEN + "Scanning blocks...");
148 Bukkit.getScheduler().scheduleAsyncDelayedTask(RedLib.getInstance(), () -> {
149 String mbs = MultiBlockStructure.stringify(locs[0], locs[1], skip);
150 player.sendMessage(ChatColor.GREEN + "The multi-block structure string has been exported to plugins/RedLib/" + filename + ".dat");
151 try {
152 Path path = getPath(filename);
153 Files.write(path, mbs.getBytes(), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
154 } catch (IOException e) {
155 e.printStackTrace();
156 }
157 });
158 }
159
160 @CommandHook("import")
161 public void importStructure(Player player, String filename) throws IOException {

Callers

nothing calls this directly

Calls 8

getInstanceMethod · 0.95
stringifyMethod · 0.95
getPathMethod · 0.95
sendMessageMethod · 0.80
getBytesMethod · 0.80
getMethod · 0.65
equalsMethod · 0.45
getWorldMethod · 0.45

Tested by

no test coverage detected