From 5e5276745904bb50fad03a28770f4c201c968b46 Mon Sep 17 00:00:00 2001 From: DaMatrix Date: Sat, 23 Nov 2019 14:30:57 +0100 Subject: [PATCH] hotfix release 0.4.1 remove redundant netty dependencies from http for now and make regionfile fall back to read-only mode --- build.gradle | 2 +- http/build.gradle | 6 ++++-- .../minecraft/world/format/anvil/RegionFile.java | 13 ++++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 8a388de54..e0b448cdd 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,7 @@ allprojects { ext { //general things javaVersion = "1.8" - porklibVersion = "0.4.0" + porklibVersion = "0.4.1" //dependency things apacheCommonsCompressVersion = "1.16.1" diff --git a/http/build.gradle b/http/build.gradle index 541a7231e..ee5cab02b 100644 --- a/http/build.gradle +++ b/http/build.gradle @@ -14,9 +14,11 @@ */ dependencies { - compile project(":network:netty-common") + //TODO: netty backend isn't implemented yet + //compile project(":network:netty-common") - compile "io.netty:netty-handler:$nettyVersion" + //compile "io.netty:netty-handler:$nettyVersion" + compile "io.netty:netty-buffer:$nettyVersion" testCompile project(":encoding") diff --git a/minecraft/src/main/java/net/daporkchop/lib/minecraft/world/format/anvil/RegionFile.java b/minecraft/src/main/java/net/daporkchop/lib/minecraft/world/format/anvil/RegionFile.java index 207276487..efcba1af4 100644 --- a/minecraft/src/main/java/net/daporkchop/lib/minecraft/world/format/anvil/RegionFile.java +++ b/minecraft/src/main/java/net/daporkchop/lib/minecraft/world/format/anvil/RegionFile.java @@ -78,6 +78,7 @@ counts. The chunk offset for a chunk (x, z) begins at byte 4*(x+z*32) in the import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.RandomAccessFile; import java.util.ArrayList; @@ -118,7 +119,17 @@ public RegionFile(File path) { lastModified = path.lastModified(); } - file = new RandomAccessFile(path, "rw"); + try { + file = new RandomAccessFile(path, "rw"); + } catch (IOException e) { + try { + //try to open in read-only mode + file = new RandomAccessFile(path, "r"); + } catch (IOException e1) { + //if that fails too, throw the original exception + throw e; + } + } if (file.length() < SECTOR_BYTES) { /* we need to write the chunk offset table */