More logging system use

This commit is contained in:
mcrcortex
2025-02-01 05:39:01 +10:00
parent f29f626a2f
commit ac135d1907

View File

@@ -149,7 +149,7 @@ public class WorldImporter {
var name = file.getName(); var name = file.getName();
var sections = name.split("\\."); var sections = name.split("\\.");
if (sections.length != 4 || (!sections[0].equals("r")) || (!sections[3].equals("mca"))) { if (sections.length != 4 || (!sections[0].equals("r")) || (!sections[3].equals("mca"))) {
System.err.println("Unknown file: " + name); Logger.error("Unknown file: " + name);
continue; continue;
} }
int rx = Integer.parseInt(sections[1]); int rx = Integer.parseInt(sections[1]);
@@ -198,7 +198,7 @@ public class WorldImporter {
var fileData = new MemoryBuffer(fileStream.size()); var fileData = new MemoryBuffer(fileStream.size());
if (fileStream.read(fileData.asByteBuffer(), 0) < 8192) { if (fileStream.read(fileData.asByteBuffer(), 0) < 8192) {
fileData.free(); fileData.free();
System.err.println("Header of region file invalid"); Logger.warn("Header of region file invalid");
return; return;
} }
this.importRegionFile(fileData, x, z); this.importRegionFile(fileData, x, z);
@@ -297,7 +297,7 @@ public class WorldImporter {
private DataInputStream decompress(byte flags, InputStream stream) throws IOException { private DataInputStream decompress(byte flags, InputStream stream) throws IOException {
ChunkCompressionFormat chunkStreamVersion = ChunkCompressionFormat.get(flags); ChunkCompressionFormat chunkStreamVersion = ChunkCompressionFormat.get(flags);
if (chunkStreamVersion == null) { if (chunkStreamVersion == null) {
System.err.println("Chunk has invalid chunk stream version"); Logger.error("Chunk has invalid chunk stream version");
return null; return null;
} else { } else {
return new DataInputStream(chunkStreamVersion.wrap(stream)); return new DataInputStream(chunkStreamVersion.wrap(stream));
@@ -330,8 +330,7 @@ public class WorldImporter {
this.importSectionNBT(x, y, z, section); this.importSectionNBT(x, y, z, section);
} }
} catch (Exception e) { } catch (Exception e) {
System.err.println("Exception importing world chunk:"); Logger.error("Exception importing world chunk:",e);
e.printStackTrace();
} }
this.updateCallback.update(this.chunksProcessed.incrementAndGet(), this.estimatedTotalChunks.get()); this.updateCallback.update(this.chunksProcessed.incrementAndGet(), this.estimatedTotalChunks.get());