@Override public boolean savePlotData(PlotBlockData plotChunk) { FileMgmt.checkOrCreateFolder(dataFolderPath + File.separator + "plot-block-data" + File.separator + plotChunk.getWorldName()); String path = getPlotFilename(plotChunk); try (DataOutputStream fout = new DataOutputStream(new FileOutputStream(path))) { switch (plotChunk.getVersion()) { case 1: case 2: case 3: case 4: /* * New system requires pushing * version data first */ fout.write("VER".getBytes(StandardCharsets.UTF_8)); fout.write(plotChunk.getVersion()); break; default: } // Push the plot height, then the plot block data types. fout.writeInt(plotChunk.getHeight()); for (String block : new ArrayList<>(plotChunk.getBlockList())) { fout.writeUTF(block); } } catch (Exception e) { TownyMessaging.sendErrorMsg("Saving Error: Exception while saving PlotBlockData file (" + path + ")"); e.printStackTrace(); return false; } return true; }