(Player player, String filename)
| 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 { |
nothing calls this directly
no test coverage detected