Skip to content

Commit

Permalink
this was a silly idea
Browse files Browse the repository at this point in the history
  • Loading branch information
btarg committed Dec 12, 2023
1 parent 7254fa7 commit 5285a8f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,11 @@ public static void removeBlockFromStorage(Location location) {
}

public static ChunkBlockInformation getBlockInformation(Chunk chunk) {
ChunkBlockInformation information = new ChunkBlockInformation(new HashMap<>());
// ignoring the exception will stop console spam for corrupted chunks
try {
information = chunk.getPersistentDataContainer().get(NamespacedKeyHelper.chunkDataKey, new InformationDataType());
} catch (Exception ignored) {
ChunkBlockInformation information = chunk.getPersistentDataContainer().get(NamespacedKeyHelper.chunkDataKey, new InformationDataType());
// initialise map if empty
if (information == null) {
information = new ChunkBlockInformation(new HashMap<>());
}

return information;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public class InformationDataType implements PersistentDataType<byte[], ChunkBloc
InputStream inputStream = new ByteArrayInputStream(primitive);
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);
return (ChunkBlockInformation) objectInputStream.readObject();
} catch (IOException | ClassNotFoundException ignored) {
// prevent console spam by ignoring
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
return new ChunkBlockInformation(null);
}
Expand Down

0 comments on commit 5285a8f

Please sign in to comment.